Forums / General / Printing Sub-folders content...

Printing Sub-folders content...

Author Message

Francis Poézévara

Thursday 19 July 2007 2:26:40 am

Hello,

I have content organized like that :

Affaires (Folder)
-- Affaire 1 (Folder)
---- Description Affaire 1 (Affaire)
---- Lot 1 Affaire 1 (Lot)
---- Lot 2 Affaire 1 (Lot)
-- Affaire 2 (Folder)
---- Description Affaire 2 (Affaire)

I would like to make a homepage which prints the description of every Affaire (it means Affaires > Affaire 1 > Description Affaire 1 and Affaires > Affaire 2 > Description Affaire 2).

First, I made a page which prints the names of the folders (Affaire 1 and Affaire 2), and it works. Then I tried to see the descriptions. When I make that :
==================================================================================
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
sort_by, $node.sort_array,
class_filter_type, include,
class_filter_array, array( 'folder') ) )}
{section name=Child loop=$children}
{let sub_children=fetch( content, list, hash( parent_node_id, $Child:item.node_id,
sort_by, $Child:item.sort_array,
class_filter_type, include,
class_filter_array, array( 'affaire') ) )}
{section name=SubChild loop=$sub_children}
{node_view_gui view=line content_node=$SubChild:item}
{/section}
{/let}

{/section}
{/let}
=======================================================================================
It doesn't work. But when I put the second loop out of the first, like that :
=======================================================================================
{let children=fetch( content, list, hash( parent_node_id, $node.node_id,
sort_by, $node.sort_array,
class_filter_type, include,
class_filter_array, array( 'folder') ) )}
{section name=Child loop=$children}

{/section}
{/let}
{let sub_children=fetch( content, list, hash( parent_node_id, $Child:item.node_id,
sort_by, $Child:item.sort_array,
class_filter_type, include,
class_filter_array, array( 'affaire') ) )}
{section name=SubChild loop=$sub_children}
{node_view_gui view=line content_node=$SubChild:item}
{/section}
{/let}
======================================================================================

It prints the description of the last Child of the loop....

What did I wrong plz ?

Christian Johansen

Thursday 19 July 2007 1:00:57 pm

Your first try looks correct at least. Have you tried printing some of the variables in the loop and so on to see whats going on? Do you get any errors in your debug outout? Both let and section are deprecated structures. Try to do the same with def/set and foreach. It's alot easier to read as well:

{def $children=false()
        $grand_children=false()}
{set $children=fetch(content, list, hash(parent_node_id, $node.node_id,
                               sort_by, $node.sort_array,
                               class_filter_type, include,
                               class_filter_array, array( 'folder')))}
{foreach $children as $child}
    {set $grand_children=fetch(content, list, hash(parent_node_id, $child.node_id,
                                                   sort_by, $child.sort_array,
                                                   class_filter_type, include,
                                                   class_filter_array, array( 'affaire')))}
    {foreach $grand_children as $grand_child}
        {node_view_gui view=line content_node=$grand_child}
    {/foreach}
{/foreach}

Francis Poézévara

Tuesday 24 July 2007 7:02:36 am

Works fine with your solution ! thx !

eZ debug

Timing: Jan 18 2025 11:23:55
Script start
Timing: Jan 18 2025 11:23:55
Module start 'content'
Timing: Jan 18 2025 11:23:56
Module end 'content'
Timing: Jan 18 2025 11:23:56
Script end

Main resources:

Total runtime1.0571 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0090 587.7031180.8438
Module start 'content' 0.00900.8863 768.5469484.5547
Module end 'content' 0.89530.1617 1,253.1016333.4844
Script end 1.0570  1,586.5859 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00520.4942210.0002
Check MTime0.00160.1560210.0001
Mysql Total
Database connection0.00080.077910.0008
Mysqli_queries0.975192.24261940.0050
Looping result0.00200.19331920.0000
Template Total1.018896.420.5094
Template load0.00260.243120.0013
Template processing1.016296.132520.5081
Template load and register function0.00020.018810.0002
states
state_id_array0.00140.129810.0014
state_identifier_array0.00210.199520.0011
Override
Cache load0.00230.2158570.0000
Sytem overhead
Fetch class attribute can translate value0.00130.121730.0004
Fetch class attribute name0.00130.121630.0004
XML
Image XML parsing0.00060.052130.0002
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00440.4183210.0002
String conversion0.00000.000830.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 15
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs