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.

eZ debug

Timing: Jan 19 2025 14:00:12
Script start
Timing: Jan 19 2025 14:00:12
Module start 'layout'
Timing: Jan 19 2025 14:00:12
Module start 'content'
Timing: Jan 19 2025 14:00:12
Module end 'content'
Timing: Jan 19 2025 14:00:12
Script end

Main resources:

Total runtime0.0176 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 589.2891152.6406
Module start 'layout' 0.00630.0032 741.929739.4766
Module start 'content' 0.00950.0060 781.406393.4922
Module end 'content' 0.01550.0021 874.898434.3047
Script end 0.0175  909.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002413.8987140.0002
Check MTime0.00116.2603140.0001
Mysql Total
Database connection0.002112.108110.0021
Mysqli_queries0.002614.582430.0009
Looping result0.00000.119410.0000
Template Total0.00169.210.0016
Template load0.00084.392410.0008
Template processing0.00084.768110.0008
Override
Cache load0.00053.020910.0005
General
dbfile0.00031.546480.0000
String conversion0.00000.058340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs