[Zope] Math with a DTML variable

Marc Burgauer marc at sharedbase.com
Thu Aug 5 14:13:54 EDT 2004


Having done some google searches with no result and referenced again 
the Zope book on DTML, I assume what I am trying is either very trivial 
or dumb:

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

The code above generates Syntax Errors. I tried referencing myCounter 
with the underscore, no luck.

Any help appreciated. If there's a web page that explains a little how 
to "manipulate variables using DTML", I'd be really thankful to know.

Cheers

Marc



More information about the Zope mailing list