Find topmost node id after node 2

Author Message

Børge Warvik

Wednesday 19 April 2006 3:49:07 am

Hi

Given this structure
-----------------------------------
Home (node 2)
| - Blog (node 3)
| - Articles (node 4)
| - - Programming (node 6)
| - - - Javascript (node 8)
| - - - PHP (node 9)
| - - Database (node 7)
| - Contact (node 5)
-----------------------------------

When user clicks on Javascript (node 8) how can I find the top most node after node 2? In this case node 4 Articles.

Thanks,
Børge

Präßler Sven

Wednesday 19 April 2006 5:44:49 am

To get the main top Node ID after the ezpublish root node you can use

{def $topID = $node.path_array.2}

Børge Warvik

Wednesday 19 April 2006 5:48:24 am

Thanks!

So in this case the $node.path_array for node 8 will be 2, 4, 6, 8?

Präßler Sven

Wednesday 19 April 2006 5:51:51 am

In this case it will be 1,2,4,6,8

Børge Warvik

Wednesday 19 April 2006 6:01:12 am

I see!

Great, thanks!
Børge

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.