How to get the id for the main parent node ?

Author Message

Selmah Maxim

Wednesday 11 August 2004 6:19:53 am

heloo ..

lets say i have this folders :

Jon folder
|
Jon Sub folder 1
|
Jon Sub folder 2
|
Jon Sub Folder 3

Now, how can I get the id of "Jon folder" node from "Jon Sub Folder 3" or 2 ??

thx in advance.

Paul Forsyth

Wednesday 11 August 2004 7:00:13 am

That should be:

{$node.parent.node_id}

paul

--
http://www.visionwt.com

Selmah Maxim

Wednesday 11 August 2004 7:49:09 am

Thanks, but you misunderstande me !

{$node.parent.node_id} will give the parent in the upper, I mean Folder 3 parent is folder 2, but i need to get the 1st parent "Jon Folder" node id from the last childe folder .

Paul Borgermans

Wednesday 11 August 2004 8:07:02 am

Hi

You could use the $node.path_string which looks like '/1/2/881/1005/1142/' which you can explode to an array

Here jon folder node id would correspond to the third position ('881')

Alternatively, you can use $node.path_array

$node.path_array.0 is always 1
$node.path_array.1 is always the content root node, mostly 2
$node.path_array.2 and higher indices are the node id 's leading to your folder (node) hierarchy

hth

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Selmah Maxim

Wednesday 11 August 2004 8:59:28 am

Thx .. I thinks this is it !, i`ll try it now !

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