[Zope] inelegant repetition of ZPT code

Wilson, Derek dwilson at abrazohealth.com
Tue Nov 25 18:15:05 EST 2003


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

I haven't tested it, but it should work.

	-----Original Message----- 
	From: Andre Meyer [mailto:a.meyer at hccnet.nl] 
	Sent: Tue 11/25/2003 1:52 PM 
	To: Zope Mailing List 
	Cc: 
	Subject: [Zope] inelegant repetition of ZPT code
	
	

	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
	
	
	
	_______________________________________________
	Zope maillist  -  Zope at zope.org
	http://mail.zope.org/mailman/listinfo/zope
	**   No cross posts or HTML encoding!  **
	(Related lists -
	 http://mail.zope.org/mailman/listinfo/zope-announce
	 http://mail.zope.org/mailman/listinfo/zope-dev )
	



More information about the Zope mailing list