[ZPT] tal:define and metal:use-macro
Troy Farrell
troy@entheossoft.com
Thu, 19 Dec 2002 13:12:58 -0600
I've been making mistakes all week, so take my words with a dose of salt :)
According to the help file:
> The effect of expanding a macro is to graft a subtree from another
> document (or from elsewhere in the current document) in place of the
> statement element, replacing the existing sub-tree. Parts of the
> original subtree may remain, grafted onto the new subtree, if the
> macro has slots. See metal:define-slot for more information. If the
> macro body uses any macros, they are expanded first.
Try something like this:
<div tal:define="var python:'def outer'">
<div metal:define-macro="m">
<div metal:define-slot="n">
var: <span tal:replace="var" />
</div>
</div>
</div>
<div tal:define="var python:'use outer'">
<div metal:use-macro="template/macros/m">
<div metal:fill-slot="n"
tal:define="var string:use inner;">
var: <span tal:replace="var" />
</div>
</div>
</div>
Think of a use-macro as more of a tal:replace="structure
template/macros/m" where no other tal functions are executed.
That help?
Troy
Scott Burchill wrote:
> Willem Broekema wrote:
>
>> Why is 'tal:define' ignored when there's also 'metal:use-macro' ?
>
>
> [ snip ]
>
>> <div metal:use-macro="template/macros/m" tal:define="var
>> python:'use inner'" />
>
> [ snip ]
>
> This goes directly to a question of mine. I have documentation
> (eek!) on what order TAL statements are executed, but nothing about
> using TAL and METAL in the same tag. Can you use both in the same
> tag? Which gets executed first? Thanks!
>
> --
>
> sbb
>
> \:)> /:(>
>
>
> _______________________________________________ ZPT mailing list
> ZPT@zope.org http://lists.zope.org/mailman/listinfo/zpt