Hey all, I have a macro, as follows: <metal:block define-macro="std"> <tr> <td colspan="3" class="help"> <i><metal:block define-slot="help"></metal:block></i> </td> </tr> <tr> <th align="right" valign="top"> <metal:block define-slot="name">NAME</metal:block> </th> <td colspan="2" class="textEntry" valign="top"> <metal:block define-slot="content">CONTENT</metal:block> </td> </tr> </metal:block> It renders a three-item block, consisting of name, value, and help text. This is the "pda" version - it gets called for clients that are pda's, and stacks the help text above the name/value, so it displays nicely on a pda - the normal version strings them side-by-side. The html designer's come back to me and said "that's great, but I've got instances where there is no help text - and I'd like the tr to not appear when there's no help text". I really don't want to have to pull this whole thing into python - at the moment, the guys doing html have control over this, it's the smallest item they do have control over, and with it they can fairly significantly change the layout of the site (in conjunction with styles etc). Ideally, I need some way to put a conditional into the macro, so that the first tr is only rendered if there's content for the help slot. Is this doable? KevinL
KevinL wrote:
Is this doable?
I don't think so using your current method. Why have you used metal slots to do this? How about: <metal:block define-macro="std"> <tr tal:condition="help|nothing"> <td colspan="3" class="help"> <i tal:content="help"></i> </td> </tr> <tr> <th align="right" valign="top" tal:content="name"> </th> <td colspan="2" class="textEntry" valign="top" tal:content="content"> </td> </tr> </metal:block> ...and get the values from a tal:define in the template that uses the macro? cheers, Chris
participants (2)
-
Chris Withers -
KevinL