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+

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 19:16:53
Script start
Timing: Jan 18 2025 19:16:53
Module start 'layout'
Timing: Jan 18 2025 19:16:53
Module start 'content'
Timing: Jan 18 2025 19:16:54
Module end 'content'
Timing: Jan 18 2025 19:16:54
Script end

Main resources:

Total runtime0.6759 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 589.2188152.6094
Module start 'layout' 0.00640.0028 741.828139.3984
Module start 'content' 0.00920.6654 781.2266651.1016
Module end 'content' 0.67460.0012 1,432.328116.2031
Script end 0.6758  1,448.5313 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00310.4638160.0002
Check MTime0.00120.1785160.0001
Mysql Total
Database connection0.00080.118910.0008
Mysqli_queries0.608490.0176730.0083
Looping result0.00140.2051710.0000
Template Total0.642095.020.3210
Template load0.00240.354020.0012
Template processing0.639694.626520.3198
Template load and register function0.00010.018110.0001
states
state_id_array0.00210.307410.0021
state_identifier_array0.00120.175920.0006
Override
Cache load0.00200.2942290.0001
Sytem overhead
Fetch class attribute can translate value0.00090.130440.0002
Fetch class attribute name0.00120.182390.0001
XML
Image XML parsing0.00370.551140.0009
class_abstraction
Instantiating content class attribute0.00000.0038120.0000
General
dbfile0.00300.4512240.0001
String conversion0.00000.001240.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs