[ZPT] tal:repeat and variables

Charlie Reiman creiman@kefta.com
Tue, 11 Feb 2003 16:30:16 -0800


> -----Original Message-----
> From: zpt-admin@zope.org [mailto:zpt-admin@zope.org]On Behalf Of
> Fernando Martins
> Sent: Tuesday, February 11, 2003 4:14 PM
> To: Zpt@Zope. Org
> Subject: [ZPT] tal:repeat and variables
>
>
> Hi,
>
> without resorting to (ugly) global variables, is there a way to
> pass values
> from one iteration of tal:repeat to another?
>
> I have a database query giving me a table like:
>
> Topic     |  Name
> --------------------
> Computers | John
> Computers | Smith
> Computers | Dilvert
> Software  | Peter
> Software  | Mary
>
> and I would like to show it like
>
> Topic     |  Name
> --------------------
> Computers | John
>           | Smith
>           | Dilvert
> Software  | Peter
>           | Mary

It should be possible to do this using something like (assuming row variable
is 'item'):

<td tal:content="python:('',item.topic)[repeat['item'].start]">topic</td>

There's probably a better way though. That kinda makes my head hurt.