This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Setup & design » Finding the 'top but one' node id

Finding the 'top but one' node id

Finding the 'top but one' node id

Saturday 12 July 2003 3:23:15 pm - 3 replies

Hello all,
I have created a subnavigation element which will get all of the child nodes to the one which you are currently viewing.
What I would like to do is if the user is further down in the site, they will be shown the second level of navigation in that section.

------ products
------ ------ red
------ ------ blue
------ ------ green
------ ------ ------ furry
------ ------ ------ smooth
------ contact
------ etc....

so when they are in:
products >> green >> furry

(or anywhere in the products section for that matter)

the subnavigation will show:

hope this makes sense. The code I am currently using is:


{let folder_list=fetch( content, list, hash(parent_node_id, $node.node_id,sort_by, array( array( priority ))))}


{section name=Folder loop=$folder_list}
<li><a href={concat("/",$Folder:item.url_alias)|ezroot}>{$|wash}</a></li>


I am using the nice url technique (thanks Karsten), hence ezroot - The variable I need to replace is $node.node_id with the node_id for the top but one node (in this case products). Because I don't know how many levels deep the site will be, I can't just refer to the grandparent node. Any ideas?

Thanks in advance,
Ben Pirt

Modified on Saturday 12 July 2003 3:25:12 pm by Ben Pirt

Saturday 12 July 2003 3:44:30 pm

If i understand your needs, I seen 2 ways (if anyone have another i'll thanks to seen it too)
You dont know the deep o site, but you know the level of top of your subnavigation. why don't use path too find the top level? something like this:

The other ir create an ini file, define there the id of top subnavigation and use ezini in template. or define directly in template (i really don't like this solution).

Hope helped

Paulo Almeida

Modified on Saturday 12 July 2003 3:52:08 pm by Paulo Almeida

Sunday 13 July 2003 2:06:34 pm

i'll try the path version
thanks for your help,

Friday 25 July 2003 1:27:52 pm

I think that $node.path_array is an array of the parent nodes ids of the actual node. $node.path_array[0] if the id of root of the site $node.path_array[1] is the id of main folder.

You may use the following code to do what you are asking for.

{section name=parent_path offset=1 loop=$node.path_array}
{let parent_node=fetch('content',node,hash(node_id,$parent_path:item))}
{$} >>


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from