[ZPT] Is this slot filled?

Evan Simpson evan@digicool.com
Mon, 7 May 2001 22:58:34 -0400


From: "Lalo Martins" <lalo@hackandroll.org>
> > Not directly, though you could define a global variable above the macro
> > use, or a local variable on a tag enclosing the macro use.
>
> You lost me here. Define a variable where? In which template,
> the one that defines the macro or the one that uses it? And use
> the variable how?

If you define a variable in template T1, which uses macro M from template
T2, then you can write code in M that uses this variable.  The variable can
be a flag indicating whether T1 uses M's slot.  For example:

<span tal:condition="(exists) slot_a_filled"><p
metal:define-slot="a">Stuff</p></span>
<span tal:condition="not:(exists) slot_a_filled">No slot A</span>

Cheers,

Evan @ digicool