[Zope] Looping in DTML
Phil Harris
phil@philh.org
Tue, 17 Aug 1999 11:06:45 +0100
As for breaking out of a loop, how about (extremely untested):
<dtml-try>
<dtml-in "_.range(total_count)">
<dtml-var sequence-item>
<dtml-if some_thing>
<dtml-raise someexception></dtml-raise>
</dtml-if>
</dtml-in>
<dtml-except someexception>
<dtml-comment>
do nothing
</dtml-comment>
</dtml-try>
the raise tag should then jump to the except tag and therefore out of the
loop or something like that, maybe, possibly, ;).
HTH
Phil
phil@philh.org
----- Original Message -----
From: Tony McDonald <tony.mcdonald@ncl.ac.uk>
To: <craigv@jps.net>; <zope@zope.org>
Sent: Tuesday, August 17, 1999 10:50 AM
Subject: Re: [Zope] Looping in DTML
> At 10:12 pm -0700 16/8/99, craigv@jps.net wrote:
> >Is there any way to do looping from within DTML? For example, I'd
> >like to execute a method a certain number of times using a counter.
> >Here's some pseudo-code to demonstrate:
> >
> ><!--#while "i < total_count"-->
> > <!--#call some_method-->
> > <!--#call "REQUEST.set('i', i+1)"-->
> ><!--#/while-->
>
> This loops total_count times and prints the number of the sequence
>
> <dtml-in "_.range(total_count)">
> <dtml-var sequence-item>
> </dtml-in>
>
> >If I can do looping, is there a way to break out of a loop?
>
> not sure about that bit!
>
> hth
> tone out
> ------
> Dr Tony McDonald, FMCC, Networked Learning Environments Project
> http://nle.ncl.ac.uk/
> The Medical School, Newcastle University Tel: +44 191 222 5888
> Fingerprint: 3450 876D FA41 B926 D3DD F8C3 F2D0 C3B9 8B38 18A2
>
> _______________________________________________
> Zope maillist - Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
>
> (To receive general Zope announcements, see:
> http://www.zope.org/mailman/listinfo/zope-announce
>
> For developer-specific issues, zope-dev@zope.org -
> http://www.zope.org/mailman/listinfo/zope-dev )
>