htp on-line reference : DEF, /DEF |
||||||||
syntax
synopsisDEF creates metatags, which is a fancy way of saying it creates new tags. The mechanism is very similar to BLOCK macros, except that the USE tag is not used to expand them. Instead, they are expanded by their own name. For example:
Some metatags will require an opening and closing tag (comparable to
You should really use BLOCKDEF, though, as it will check for matching end tag. It is not that slower. Options can be passed to a metatag, which can then expand as if it were a SET macro. Option names are parameterized with the OPTION attribute. Multiple options can be listed by separating their name with a space (which therefore requires they be surrounded by quotes.)
htp will do very specific checking of parameters when a metatag is invoked. htp assumes that all parameter options to the metatag are optional. This is why the HEADERIMG definition uses IF to verify the SIZE option is defined before expanding it in the block. If a parameter is required, simply expand it without first checking. When htp expands the metatag and the macro is not defined, it will halt processing and complain with an error message and the required macro name. Normally htp will not allow parameters not listed in the OPTION attribute to be added to the tag. This is why the third invocation of HEADERIMG will fail. There is no ALT parameter specified in the OPTION attribute. However, there is the special option *, which matches every other parameter. It should be used to pass all other options to another tag. Metatags can be removed by using the UNDEF tag. Note that both open and close tags must be removed with UNDEF. Removing one will not remove both.
Warning:
Although possible, You can find some other examples in the metatag section of the tutorial.
|
||||||||
|
||||||||
htp on-line reference / http://htp.sourceforge.net/ref/
Authors: Jim Nelson, Jochen Hoenicke, Michael Möller. Maintainers: Jochen Hoenicke.
Copyright © 1995-96 Jim Nelson. last updated Tue Feb 22, 2011 |