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.