[Zope] inelegant repetition of ZPT code

Phil Harris phil at harris-family.info
Tue Nov 25 18:23:46 EST 2003


That won't work because you have badly formed html in there.

The <tr>s are badly nested with the spans, you must have correctly
formed html when using TAL.

Phil
On Tue, 25 Nov 2003 16:15:05 -0700
"Wilson, Derek" <dwilson at abrazohealth.com> wrote:

dwilson> How about:
dwilson>  
dwilson> <table>
dwilson>     <span tal:repeat="item here/listItems">
dwilson>        <span tal:condition="repeat/item/even"><tr bgcolor="white"></span>
dwilson>        <span tal:condition="repeat/item/odd"><tr bgcolor="lightgray"></span>
dwilson>                    <td>...</td>
dwilson>         </tr>
dwilson>     </span>
dwilson> </table>
dwilson> 
dwilson> I haven't tested it, but it should work.
dwilson> 
dwilson> 	-----Original Message----- 
dwilson> 	From: Andre Meyer [mailto:a.meyer at hccnet.nl] 
dwilson> 	Sent: Tue 11/25/2003 1:52 PM 
dwilson> 	To: Zope Mailing List 
dwilson> 	Cc: 
dwilson> 	Subject: [Zope] inelegant repetition of ZPT code
dwilson> 	
dwilson> 	
dwilson> 
dwilson> 	Hi Zopers
dwilson> 	
dwilson> 	Another detail that bugs me: how can I translate the following dtml code
dwilson> 	to zpt. It colours table rows in grey/white alternatively. Is the zpt
dwilson> 	version below the only way? It is clearly very inelegant to repeat code.
dwilson> 	
dwilson> 	
dwilson> 	DTML
dwilson> 	
dwilson> 	...
dwilson> 	<table>
dwilson> 	    <dtml-in listItems>
dwilson> 	        <tr <dtml-if sequence-even>bgcolor="lightgray"</dtml-if>>
dwilson> 	            <td>...</td>
dwilson> 	        </tr>
dwilson> 	    </dtml-in>
dwilson> 	</table>
dwilson> 	
dwilson> 	
dwilson> 	ZPT
dwilson> 	
dwilson> 	...
dwilson> 	<table>
dwilson> 	    <span tal:repeat="item here/listItems">
dwilson> 	        <tr bgcolor="white" tal:condition="repeat/item/even">
dwilson> 	            <td>...</td>
dwilson> 	        </tr>
dwilson> 	        <tr bgcolor="lightgray" tal:condition="repeat/item/odd">
dwilson> 	            <td>...</td>
dwilson> 	        </tr>
dwilson> 	    </span>
dwilson> 	</table>
dwilson> 	
dwilson> 	
dwilson> 	thanks and best wishes
dwilson> 	Andre
dwilson> 	
dwilson> 	
dwilson> 	
dwilson> 	_______________________________________________
dwilson> 	Zope maillist  -  Zope at zope.org
dwilson> 	http://mail.zope.org/mailman/listinfo/zope
dwilson> 	**   No cross posts or HTML encoding!  **
dwilson> 	(Related lists -
dwilson> 	 http://mail.zope.org/mailman/listinfo/zope-announce
dwilson> 	 http://mail.zope.org/mailman/listinfo/zope-dev )
dwilson> 	
dwilson> 

-- 
Phil Harris <phil at harris-family.info>





More information about the Zope mailing list