How to list submenus?

Author Message

Marius Andreiana

Monday 13 October 2003 2:40:05 pm

Hi

In left_menu.tpl I'm trying to list a submenu for current node, like this site:
http://www.cleara.com/content/view/full/57/

This is the code:
{* Left menu START *}
{let articleList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
'sort_by', $node.sort_array ) )}

{let children=fetch('content',list,hash('parent_node_id',2))}
{section name=Child loop=$children}
<a href={$Child:item.url_alias|ezurl}>{$Child:item.name|wash}</a><br>
{section name=articleLoop loop=$articleList show=eq($node.node_id,$Child:item.node_id}
{$articleLoop:item.name}
{/section}

{/section}

{/let}
{/let}

{* Left menu END *}

It won't print anything after the link. If I put this block somwhere else it will work:
{let articleList=fetch( 'content', 'list', hash( 'parent_node_id', $node.node_id,
'sort_by', $node.sort_array ) )}
{section name=articleLoop loop=$articleList}
{$articleLoop:item.name}
{/section}
{/let}

I've spent a lot of time on docs trying to see what the problems is, but I don't realize it. Help please?

note: I've put left_menu.tpl content directly in pagelayout.tpl

Claus Jensen

Tuesday 14 October 2003 1:11:49 am

Hi,
This works:
{let node_obj=fetch(content,node,hash(node_id,$node.node_id))}
{section loop=fetch(content,list,hash(parent_node_id,2, class_filter_type, "include", class_filter_array, array(1),sort_by,array(array(priority))))}
{section show=and(ne($:item.node_id, 131),ne($:item.node_id, 130))}
{$:item.data_map.menu_title.data_text}
{section show=$node_obj.path_array loop=fetch(content,list,hash(parent_node_id,$:item.node_id, sort_by,array(array(priority))))}
{$:item.data_map.menu_title.data_text}
{/section}
{/section}
{/section}
{/let}

If I were you I would try doing the looping the other way around. Like first looping the frontpages children, then fetching the nodes under it and looping them. Like in my example over. Its taken from the ezwiki (http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree) and refined for my needs.

regards,
claÜs

Marius Andreiana

Thursday 16 October 2003 2:42:45 am

Thank you, I've missed the wiki example! It worked!

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 16:22:07
Script start
Timing: Jan 18 2025 16:22:07
Module start 'layout'
Timing: Jan 18 2025 16:22:07
Module start 'content'
Timing: Jan 18 2025 16:22:08
Module end 'content'
Timing: Jan 18 2025 16:22:08
Script end

Main resources:

Total runtime1.2665 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 587.7891152.6094
Module start 'layout' 0.00610.0029 740.398439.4297
Module start 'content' 0.00901.2558 779.8281478.5547
Module end 'content' 1.26480.0017 1,258.382812.1875
Script end 1.2665  1,270.5703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.2585160.0002
Check MTime0.00150.1149160.0001
Mysql Total
Database connection0.00110.089210.0011
Mysqli_queries1.218196.1738570.0214
Looping result0.00060.0445550.0000
Template Total1.233697.420.6168
Template load0.00180.142720.0009
Template processing1.231897.258520.6159
Template load and register function0.00020.017010.0002
states
state_id_array0.00070.058410.0007
state_identifier_array0.00220.169820.0011
Override
Cache load0.00160.1249470.0000
Sytem overhead
Fetch class attribute can translate value0.00070.055920.0004
Fetch class attribute name0.00140.113730.0005
XML
Image XML parsing0.00020.018020.0001
class_abstraction
Instantiating content class attribute0.00000.000730.0000
General
dbfile0.00070.0589100.0001
String conversion0.00000.000740.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
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
7content/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: 21
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs