The <tmplblock> tag defines a new custom tag, that can later
be inserted with the <tmplinsertblock> tag or the
<tmplinsertall> tag.
Insertion of a tag is done when the <tmplinsertblock> or
<tmplinsertall> tag finds the tag in the content file. Then
the contents of the <tmplblock> tag will be inserted. Within
that contents $tag name$ will be replaced by the contents from
the tag in the content file. $attribute name$ will be replaced
by that attribute value from the tag in the contents file, or by a
default value as defined by the <tmpldefaultparam> tag. The
attribute must have been specified in the params attribute
of the <tmplblock> tag. Finally $varargs$ will be
replaced by all other attributes given to the tag in the content file.
It is possible to redefine RXML and HTML tags with the
<tmplblock> tag. However, you should be very careful when
choosing name for your custom tags so they don't interfere with any
RXML or HTML tags. For example, if you define a tag, <option>,
it will interfere with HTML forms, since the <select> tag
uses <option> tags.
It is possible to change the tag definition between insertions. The
<tmplinsertblock> tag or <tmplinsertall> tag will
always use the latest definition. Each time an insertion is done all
matching tags from the entire content file will be inserted. This way
it is possible to first create an index for the page, with a list of
all headers, and then insert the contents with the headers as
graphical headers.
Within the contents the <tmpldefaultparam> container tag
can be used, to specify default values for attributes. It takes the
attribute params to specify which attribute it should give
a default value to.
It is possible to use a <tmplinsertblock> or
<tmplinsertexcept> inside a <tmplblock> tag. In that
case the <tmplinsertblock> tag will not search the whole
content file for tags to insert but rather the contents of the current
tag. That way it is possible to define tags that contain tags
themselves. You should however not combine the use
<tmplinsertblock> with the use of $tag name$ to insert
the contents, since the result will probably not be what you expect.
Attributes
- tag=name
-
The name of the tag.
- singletag
-
The tag is a simple tag rather than a container tag.
- params=name,name,...
-
Names of all attributes this tag should handle. The values of the
attributes will be available within the contents as $name$.
Example
<tmplblock tag=cow singletag params=name>
$name$,
</tmplblock>
<tmplblock tag=cows>
We own the cows named <tmplinsertblock tag=cow>.
</tmplblock>
...
<cows>
<cow name=Rosy>
<cow name=THX>
<cow name=Mad>
</cows>
We own the cows named Rosy, THX, Mad,
|