[ZPT] tal:define and metal:use-macro
Willem Broekema
willem@pastelhorn.com
Thu, 19 Dec 2002 16:05:54 +0100
Why is 'tal:define' ignored when there's also 'metal:use-macro' ?
Take the following macro definition and usage:
// define macro:
<tal:dummy tal:define="var python:'def outer'">
<div metal:define-macro="m">
var: <span tal:replace="var" />
</div>
</tal:dummy>
// use macro:
<div tal:define="var python:'use outer'"> <-- this define is used
<div metal:use-macro="template/macros/m"
tal:define="var python:'use inner'" /> <-- this one is ignored
</div>
This will display "var: use outer" for the macro use. The tal:define in
the inner <div> is ignored. Is there a reason for this?
To include parameterized macros, I would like to pass around variables as:
<div metal:use-macro="..."
tal:define="display_option1 value1; do2 v2; ...">
macro contents, customized by the display options
</div>
Now, this needs an ugly dummy tag:
<tal:dummy tal:define="display_option1 value1; do2 v2; ...">
<div metal:use-macro="..."
here comes the macro contents
</div>
</tal:dummy>
- Willem