[Zope] Looping in DTML

Andreas Kostyrka andreas@mtg.co.at
Tue, 17 Aug 1999 11:46:49 +0200 (CEST)


On Mon, 16 Aug 1999 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-->
> 
> If I can do looping, is there a way to break out of a loop?
Nope. You cannot do general looping, as a while construct would allow
you to build nonterminating loops.

You can try this:
<dtml-in "_.range(100)">
<dtml-var sequence-item> <BR>
</dtml-in>

Andreas
--
Andreas Kostyrka                     | andreas@mtg.co.at
phone: +43/1/7070750                 | phone: +43/676/4091256   
MTG Handelsges.m.b.H.                | fax:   +43/1/7065299
Raiffeisenstr. 16/9                  | 2320 Zwoelfaxing AUSTRIA