[Zope] Re: metal:fill-slot and tal:condition
Tonico Strasser
contact_tonico at yahoo.de
Thu Feb 22 07:00:46 EST 2007
Dragos Chirila schrieb:
> Hi everybody,
>
> I am stuck with the following problem. I would appreciate it very much
> if you could help me with it.
[snip]
If I understand correctly you want to fill a slot if a condition is true
else leave the default.
A typical "slot-modell" looks something like this:
Template I:
<a metal:define-macro="A">
<b metal:define-slot="B">
default
</b>
</a>
Template II:
<a metal:use-macro="here/TemplateI/macros/A">
<b metal:fill-slot="B">
custom
</b>
</a>
A different approach, a "use-macro-modell":
Template I:
<a metal:define-macro="A"
tal:define="macros here/getmacros">
<b metal:use-macro="macros/B"/>
</a>
Python Script getmacros:
macros = {}
# default_macros, custom_macros are page templates.
macros.update(container.default_macros.macros)
if blah:
macros.update(container.custom_macros.macros)
return macros
This is oversimplified, but I hope it helps you to find a solution.
Regards,
Tonico
More information about the Zope
mailing list