[Zope] inelegant repetition of ZPT code
Andre Meyer
a.meyer at hccnet.nl
Tue Nov 25 15:52:51 EST 2003
Hi Zopers
Another detail that bugs me: how can I translate the following dtml code
to zpt. It colours table rows in grey/white alternatively. Is the zpt
version below the only way? It is clearly very inelegant to repeat code.
DTML
...
<table>
<dtml-in listItems>
<tr <dtml-if sequence-even>bgcolor="lightgray"</dtml-if>>
<td>...</td>
</tr>
</dtml-in>
</table>
ZPT
...
<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>
thanks and best wishes
Andre
More information about the Zope
mailing list