[ZPT] Placeholder question

Scott Burton mrzope@hotmail.com
Mon, 19 Nov 2001 23:29:26 +0000


Is there a way you can create a placeholder for counting iterations on 
tal:repeat? For instance, you have 3 items in a list which each item has a 
numbered value. You would like to iterate over the items and add up a total. 
So normally you could do:
<dtml-call "REQUEST.set('total', 0)">
<dtml-in list>
<dtml-call "REQUEST.set('total', total + 1)">
</dtml-in>
<dtml-var total>

Where the first tag creates a variable who's total is 0. It could be an 
empty string as well. Then I iterate over the items in the list and count 
how many iterations by storing it in the placeholder. Or it could be used to 
add up values to get a total.

So, how do I create an empty variable in zpt? I have tried <span 
tal:define="global total ''"></span> or <span tal:define="global total 
0"></span>

I  figured I could do the math with <span tal:define="total python:total + 
1"></span> within the repeat tag. So it looks to me as if the placeholder 
issue is what is holding me back.

_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp