[ZPT] Placeholder question
Scott Burton
mrzope@hotmail.com
Tue, 20 Nov 2001 00:00:01 +0000
>From: Richard Jones <richard@bizarsoftware.com.au>
>Reply-To: richard@bizarsoftware.com.au
>To: "Scott Burton" <mrzope@hotmail.com>, zpt@zope.org
>Subject: Re: [ZPT] Placeholder question
>Date: 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?
I was using that as an example. For my particular case, I have a number of
prices in a list I need to add together.
>
>
> > 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.
That is why I am using python:total + 1. It is a simple calculation. Plus, I
need it to be calculated at the time the page template is being rendered. It
also seems sloppy to have to create another method to do such a simple
thing. Page templates do use logic-in-page. Iteration, expression,
conditional elements etc.
>
>
> Richard
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp