substitute for {section loop=... construct

Author Message

Patrick Kaiser

Wednesday 13 July 2005 5:33:46 am

hi,
in the new documentation is stated that the {section -construct should be avoided in the future. since i'm relativly new to ez-publish i'd like to get used to the the 'right' ways of template programming right from the beginning. but i cannot find a way to loop over results from a fetch differently than the old {section loop=... way.

i tried it with 'while' and 'for' statments with no success..

what is best practice for looping over results using the new control structures?

thanks, patrick


Best regards,

Patrick

Frederik Holljen

Wednesday 13 July 2005 5:47:04 am

Use foreach:
{foreach $arrayVar as $variableName}
{$variableName}
{/foreach}

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 31 2025 00:19:34
Script start
Timing: Jan 31 2025 00:19:34
Module start 'layout'
Timing: Jan 31 2025 00:19:34
Module start 'content'
Timing: Jan 31 2025 00:19:34
Module end 'content'
Timing: Jan 31 2025 00:19:34
Script end

Main resources:

Total runtime0.0254 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0047 588.1484151.2109
Module start 'layout' 0.00470.0042 739.3594220.6875
Module start 'content' 0.00890.0149 960.0469997.8047
Module end 'content' 0.02370.0016 1,957.851629.9922
Script end 0.0253  1,987.8438 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002811.1258140.0002
Check MTime0.00124.6230140.0001
Mysql Total
Database connection0.00083.163510.0008
Mysqli_queries0.00238.917830.0008
Looping result0.00000.043310.0000
Template Total0.00114.510.0011
Template load0.00093.471010.0009
Template processing0.00031.037310.0003
Override
Cache load0.00062.437510.0006
General
dbfile0.00145.351880.0002
String conversion0.00000.034840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs