How to limit foreach loop

Author Message

Stéphane Bullier

Thursday 15 September 2005 7:25:20 am

Hello,

How to limit a fetch tree like that :

{section name=random loop=$randomised_array max=2}

with shuffle extension; I can't use limit because I want fetch all the node of my folder :

{def $cas_client=fetch( 'content', 'tree', 
	                hash( 'parent_node_id', 84,
	                      'class_filter_type',  'include',
                              'class_filter_array', array( 'cas_client') ) )|shuffle}
	
{foreach $cas_client as $cas_clients}
{node_view_gui view='line' content_node=$cas_clients}
{/foreach}

Thank you. Best regards.

Stéphane

Kristof Coomans

Thursday 15 September 2005 11:00:46 pm

{foreach $cas_client as $cas_clients max 2}
...
{/foreach}

See http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_control_structures/looping/foreach .

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Stéphane Bullier

Friday 16 September 2005 12:56:46 am

Hello Kristof,

Thank you for your answer.

Bye

Stéphane

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 06:18:47
Script start
Timing: Jan 31 2025 06:18:47
Module start 'layout'
Timing: Jan 31 2025 06:18:47
Module start 'content'
Timing: Jan 31 2025 06:18:47
Module end 'content'
Timing: Jan 31 2025 06:18:47
Script end

Main resources:

Total runtime0.0350 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0056 588.1250151.2109
Module start 'layout' 0.00560.0041 739.335936.6484
Module start 'content' 0.00960.0235 775.984490.1406
Module end 'content' 0.03320.0018 866.125033.9922
Script end 0.0350  900.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00287.9283140.0002
Check MTime0.00123.4555140.0001
Mysql Total
Database connection0.00071.956210.0007
Mysqli_queries0.00257.279430.0008
Looping result0.00010.148410.0001
Template Total0.00133.610.0013
Template load0.00102.801910.0010
Template processing0.00030.776910.0003
Override
Cache load0.00071.873110.0007
General
dbfile0.008624.466480.0011
String conversion0.00000.036840.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