[Zope] Math with a DTML variable
Jonathan Hobbs
toolkit at magma.ca
Thu Aug 5 15:35:29 EDT 2004
----- Original Message -----
From: "Marc Burgauer" <marc at sharedbase.com>
> I want to do some math in DTML, here an example:
>
> <dtml-let myCounter=0>
> <dtml-in expr="some_method(_['a_current_id'])">
>
> <dtml-if checked>
> <dtml-call expr="myCounter=myCounter+1">
> </dtml-if>
>
> </dtml-in>
>
> <dtml-if expr="myCounter>0">
>
> DO SOMETHING!
>
> </dtml-if>
>
> </dtml-let>
>
> "some_method" returns a sequence where some items might have an
> attribute "checked". So while I iterate over the sequence I want to
> change the value of "myCounter".
You need to set up and manipulate the counter as follows:
<dtml-call "REQUEST.set('myCounter', 0)">
<dtml-call "REQUEST.set('myCounter', myCounter+1)">
This would be much cleaner in a python script.
HTH
Jonathan
More information about the Zope
mailing list