[ZPT] Conditional attributes in TAL?

Ian Bicking ianb at colorstudy.com
Mon Mar 1 19:48:43 EST 2004


On Mar 1, 2004, at 6:38 PM, Jan Van Uytven wrote:
> This is my first posting to this list, so forgive me if for my newbie
> questions.
>
> I have a ZSQL method that returns data for a TAL repeat tag. Now I want
> to present the returned info in a table. I also want to apply a
> different CSS style to a row depending on whether it's an even or odd
> row. Sounds simple enough, but to my dismay there doesn't seem to be a
> TAL method for adding an attribute to a tag depending on a given
> condition. My hack is to do something like:

Try:

<tr tal:attributes="class python: test(repeat['pc'].even(), 'evenrow', 
'oddrow')">...

--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org




More information about the ZPT mailing list