ZPT - conditional metal:define-slot
I have a template (Only relevant parts here) <td width="20%" bgcolor="#CCCCCC"> <div metal:define-slot="leftColumn">leftColumn</div> </td> <td width="60%" bgcolor="#FFFFFF"> <div metal:define-slot="primary">primary content</div> </td> <td width="20%" bgcolor="#FFFFFF"> <div metal:define-slot="secondary">secondary content</div> </td> Wich I call like: <div metal:fill-slot="leftColumn"> Lef content </div> <div metal:fill-slot="primary"> primary content </div> <div metal:fill-slot="secondary"> secondary content </div> But I would really like the "secondary" column/td to be optional. So that if I don't have any content for it, it will no be there. Does anybody have a clue as for the best way to do something like this? regards Max M
doesn't
<div metal:fill-slot="secondary" tal:condition="secondary"> secondary content </div>
work? -- martin; (greetings from the heart of the sun.) \____ echo mailto: !#^."<*>"|tr "<*> mailto:" net@madduck NOTE: The pgp.net keyservers and their mirrors are broken! Get my key here: http://people.debian.org/~madduck/gpg/330c4a75.asc "it appears that pl/i (and its dialects) is, or will be, the most widely used higher level language for systems programming." -- j. sammet
martin f krafft wrote:
doesn't
<div metal:fill-slot="secondary"
tal:condition="secondary">
secondary content </div>
work?
No. It gives an error.. The problem is that I don't really know how to test if a "metal" slot has been "called" or not. <td tal:condition="here/secondary | nothing"> <div metal:define-slot="secondary">secondary content</div> </td> It is my: tal:condition="here/secondary | nothing", that doesn't do what I would like it to. It really should test false if: <div metal:fill-slot="secondary">something</div> hasn't been defined in the zpt using my macro. Or something to that effect. The only solution that comes to mind right now, would be if I had two different macros. One for two columns and one for three columns. But that is unelegant and leaves the possibility that the 2 files come out of sync. So I really would prefer just one macro. regards Max M
participants (2)
-
martin f krafft -
Max M