[ZPT] tal:repeat and variables

Fernando Martins fmartins@hetnet.nl
Wed, 12 Feb 2003 01:14:18 +0100


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

I can do it using a global variable which keeps the last topic used. If the
current row topic is the same as the global last, don't show it.

I don't have much experience with zpt but I felt the need for keeping
information from one iteration of tal:repeat to another. Is there a way to
do it?

It would be nice to have a repeat/vars dictionary allowing me to keep and
modify variables in it for the duration of tal:repeat. The variables would
be initialised before the tal:repeat.

Is something like this possible and I'm missing it?

Regards,
Fernando Martins