[ZPT] Placeholder question

Richard Jones richard@bizarsoftware.com.au
Tue, 20 Nov 2001 10:56:20 +1100


On Tuesday 20 November 2001 10:29, Scott Burton wrote:
> 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.

Does the standard Iterator "length" method not suit here?


> 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.

TAL / Page Templates discourage this sort of logic-in-page stuff that DTML 
allows. The code for calculations typically belongs out in other code.


    Richard