![]() htp on-line reference : GLOBAL and EXPAND |
|
Normally when you define a macro it is only defined in the current
scope. A scope is for example the definition of a metatag. Once the
definition is expanded and the metatag has finished the macro is
automatically removed. In some cases you want to define a macro
inside a metatag and use it later. You can do this with the
GLOBAL attribute.
The EXPAND attribute is not a tag of its own, but it can be used with all block tags even with metatags defined with the BLOCKDEF macro. The expansion of HTP tags, metatags and macros is normally only done when the HTML document is written. When a block tag is marked with the EXPAND modifier it is expanded immediately. This is most useful if you want to store something in a block macro, that depends on the current value of another macro. This other macro may no longer have the correct value when the macro is expanded. The following code shows the definition of a typical SECTION metatag. The block surrounded by section tags is stored in a global variable as well as the title of the section. The name of these variables is generated from a section counter SECTCTR, that is increased with each definition.
<SET SECTCTR=0> <BLOCKDEF name="section" option="title"> <INC SECTCTR> <SET TITLE${SECTCTR}=$title GLOBAL> <BLOCK SECT${SECTCTR} GLOBAL EXPAND> <USE BLOCK> </BLOCK> </BLOCKDEF>
|
|
htp on-line reference / http://htp.sourceforge.net/ref/
Authors: Jim Nelson, Jochen Hoenicke, Michael Möller. Maintainers: Jochen Hoenicke, Michael Möller.
Copyright © 1995-96 Jim Nelson. last updated Mon May 27, 2002 |