[ZPT] macros and contexts

Dieter Maurer dieter at handshake.de
Sat Sep 13 08:06:10 EDT 2003


Seb Bacon wrote at 2003-9-12 13:18 +0100:
 > ...
 > This is kind of difficult to explain, partly because I suspect I am 
 > trying to abuse macros.  I want to use macros to display objects other 
 > than the current context.  So, say I have a macro in a ZPT called widgetlib:
 > 
 >   <div metal:define-macro="widget_1_view">
 >     I am the widget 1 view on <span tal:replace="here/getId">some
 >     id or other</span>
 >   </div>
 > 
 > And I use it like this:
 > 
 >   <div metal:use-macro="here/widgetlib/macros/widget_1_view">
 >     Widget 1 view goes here
 >   </div>
 > 
 > How can I cause the above macro invocation to use a different value for 
 > 'here'?

You can't easily.

In my view, one of the weakest points of the current METAL implementation.
It prevents us from building macro libraries where macros refer
other macros in this and related macro libraries.

You can hack around this by refering to library relative objects
via absolute (or other adequate paths sufficiently independent
from here/container) paths. A hack, indeed...


Dieter



More information about the ZPT mailing list