Forums / Setup & design / while loop

while loop

Author Message

Marko Žmak

Saturday 22 January 2005 2:57:40 pm

Is there any way I can make a while loop in eZ?

I would like to make a section that loops until some condition becomes false. As far as I know, {section loop=...} loops only through an array or a specified number of times. But I want to make it loop a variable number of times, until some condition is true.

How do I do that?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Roy Bøhmer

Tuesday 25 January 2005 10:51:18 am

What about setting a max value of iterations, and inside the loop alter the max-variable?

{let max=1}
{section loop=$array max=$max}
  ...
  {section show=$condition}
     {set max=1}
  {section-else}
     {set max=sum($max,1)}
  {/section}

{section}

I've not tested this piece of code, but it might give you some ideas.

Roy

Marko Žmak

Tuesday 25 January 2005 2:34:09 pm

Tried it. Doesn't work. Does anyone have any idea? What about folks that know how eZ works from the inside? Is there any way to do this?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Thursday 27 January 2005 4:27:26 am

Is there any way to do this in eZ 3.5 maybe? I couldn't find a sollution in previous versions.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Masamune

Thursday 18 August 2005 7:38:16 am

Hi there, I'm stuck in the same problem, unfortunately I haven't found any solution yet.
Seems the template script does not support such statement....

Marko Žmak

Thursday 18 August 2005 8:43:21 am

The sollution exists. Look here:

http://ez.no/community/developer/specs/improved_template_syntax

Could someone tell us in what version of eZ this new syntax is implemented?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Daniel Guerrier

Thursday 18 August 2005 5:22:23 pm

It is available in 3.6+