[ZPT] Fiddly repeat

Dieter Maurer dieter at handshake.de
Wed Sep 24 20:53:36 EDT 2003


Charlie Clark wrote at 2003-9-23 20:37 +0200:
 > I'd like to be able to loop through a result-set in a table and have say 
 > three columns per row for the same results. What is the best way to do 
 > this? I've tried the following which for pretty obvious reasons doesn't 
 > work.
 > 
 > <table tal:define="items here/query">
 > 	<div tal:repeat="item items">
 > 		<tr tal:condition="python: test(repeat['item'].number() % 3 == 0, 1 ,0)">
 > 			<td tal:content="item/value"></td>
 > 		</tr>
 > 	</div>
 > </table>
 > 
 > Are there any alternatives using tal or is it best to do this in a 
 > PythonScript?

At least, it is much easier to create a 2 level list in a Python Script
and just present it in a template than to do it all in the template...


Dieter



More information about the ZPT mailing list