[Zope] How do you increment a variable?

Kevin Dangoor kid@kendermedia.com
Thu, 29 Jul 1999 07:55:30 -0700 (PDT)


--- Tony McDonald <tony.mcdonald@ncl.ac.uk> wrote:
> This does work, I then tried to extend it with
> <dtml-with "_(counter=1)">
>    <dtml-var counter>
>    <dtml-in "_.range(0,10)">
>    <dtml-let counter="counter+1">
>      <dtml-var counter>
>   </dtml-let>
> </dtml-in>
> </dtml-with>
> 
> and got 1 2 2 2 2 2 2 2 2 2 2.
> Is that because the <dtml-in> tag sets up another
> name space?

Actually, I believe this is because dtml-let is
setting up another namespace. Your original "uglier"
version works, though:

<dtml-var standard_html_header>
<dtml-call "REQUEST.set('counter', 1)">
<p><dtml-var counter></p>
<dtml-in "_.range(0,10)">
<dtml-call "REQUEST.set('counter', counter+1)">
<p><dtml-var counter></p>
</dtml-in>
<dtml-var standard_html_footer>

Kevin
_____________________________________________________________
Do You Yahoo!?
Free instant messaging and more at http://messenger.yahoo.com