[Zope] inelegant repetition of ZPT code

Jamie Heilman jamie at audible.transient.net
Tue Nov 25 16:00:31 EST 2003


Andre Meyer wrote:
> <table>
>     <span tal:repeat="item here/listItems">
>         <tr bgcolor="white" tal:condition="repeat/item/even">
>             <td>...</td>
>         </tr>
> 	<tr bgcolor="lightgray" tal:condition="repeat/item/odd">
>             <td>...</td>
>         </tr>
>     </span>
> </table>

use css, and python:

<table>
<tr tal:repeat="i here/listItems"
    tal:attribute="class python:path('repeat/i/odd') and 'shaded' or nothing">
 <td>...</td>
</tr>
</table>

-- 
Jamie Heilman                     http://audible.transient.net/~jamie/
"Most people wouldn't know music if it came up and bit them on the ass."
                                                        -Frank Zappa



More information about the Zope mailing list