[Zope3-dev] Re: tal:define="..." considered harmful?
jmo at ita.chalmers.se
Mon Feb 13 08:11:01 EST 2006
Tonico Strasser wrote:
> (Again with the right quote, sorry.)
> Jean-Marc Orliaguet wrote:
>> That's exactly what I'm saying: if templates did not try to create
>> their own data layer, the 'li_repeat' macro could get the data from
>> the model (instead it has to rely on cross-template communication)
>> that's an anti-pattern which is the consequence of having introduced
>> tal:define. :-)
> Hm. How else would you use the _same_ macro with different names in
> the same template?
"tal:define" is used here to pass parameters to the macro. In ZPT this
is done implicitly, which is why macros specify a list a variables that
must be defined.
In other language this is done explictly. (cf. XSLT <xsl:with-param ...>)
If it was done explicitly in ZPT it could look like:
<li metal:use-macro="macros/li_repeat" metal:with-params="items1" />
<li metal:use-macro="macros/li_repeat" metal:with-params="items2" />
More information about the Zope3-dev