[ZPT] "template/macros" not available?

Dieter Maurer dieter@handshake.de
Mon, 9 Sep 2002 20:45:53 +0200


Jan-Wijbrand Kolman writes:
 > ...
 > I'm working with PageTemplates for quite some time now, however 
 > somehow this is the first time I try to do a "use-macro" *within the 
 > same pagetemplate* the macro is defined in. I.e.:
 > ...
 > So, to use it *within the same* pagetemplate I thought to use the 
 > "template" namespace. I.e.:
 > 
 > some_template.zpt:
 > --------------------------------------------------------
 >   [snip]
 >   <metal:block use-macro="template/macros/reusable" />
 >   [snip]
 > 
 > 
 > This seems not work. However, a "self reference" like...
It does, but only as long as you do not use it as part of
a larger macro body. This is because the standard predefined
ZPT macros are initialized only once when the rendering of the
outer macro starts and remain then unchanged across all macro
expansions.

I think this is a severe limitation and tries to remove the restriction.
But, it turned out to be too effort intensive.

 > some_template.zpt:
 > -----------------------------------------------------
 >   [snip]
 >   <metal:block use-macro="here/some_template.zpt/macros/reusable" />
 >   [snip]
 > 
 > 
 > ...*does* work.
Always do this, as it is more (but not yet completely) resilient 
with respect to nested macro definitions.


Dieter