[ZPT] table loop
Evan Simpson
evan@zope.com
Wed, 15 Aug 2001 17:28:12 -0400
Georges J Baladi Jr wrote:
> a folder with 19 images
>
> a page template that display the images inside a table. I want to put
> 5 images in a row.
You can't make partial tags with TAL statements, but you can do what you
want in a totally different way:
## Script (Python) "getGroupsOfN"
##parameters=seq, at_a_time
##
from ZTUtils import Batch
b = Batch(seq, at_a_time, orphan=0)
batches = [b]
while b.next:
b = b.next
batches.append(b)
return batches
# End Script
<table width="100%" border="0" cellspacing="0" cellpadding="0"
tal:define="images python:here.conteudo.objectValues('Image');
batches python:here.getGroupsOfN(images, 5)">
<tr tal:repeat="batch batches">
<td tal:repeat="thumb batch">
<img src="/images/papel/campeonato.jpg" width="100"
height="75" tal:replace="structure thumb">
</td>
</tr>
</table>
> I think Zope and ZPT are the best solution for web publishing. Itīs an
> excellent software.
Thanks,
Evan @ Zope