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 15 2025 00:55:32
Script start
Timing: Jan 15 2025 00:55:32
Module start 'layout'
Timing: Jan 15 2025 00:55:32
Module start 'content'
Timing: Jan 15 2025 00:55:34
Module end 'content'
Timing: Jan 15 2025 00:55:34
Script end

Main resources:

Total runtime1.4370 sec
Peak memory usage6,144.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0046 686.6328183.7031
Module start 'layout' 0.00460.0028 870.335952.5938
Module start 'content' 0.00741.4281 922.92971,854.7109
Module end 'content' 1.43550.0015 2,777.640668.5078
Script end 1.4370  2,846.1484 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00500.3489160.0003
Check MTime0.00110.0753160.0001
Mysql Total
Database connection0.00050.037210.0005
Mysqli_queries1.364494.9435650.0210
Looping result0.00080.0564630.0000
Template Total1.399097.420.6995
Template load0.00400.276520.0020
Template processing1.395097.078120.6975
Template load and register function0.00140.098910.0014
states
state_id_array0.00110.076010.0011
state_identifier_array0.00120.083420.0006
Override
Cache load0.00360.2534360.0001
Sytem overhead
Fetch class attribute can translate value0.00060.038530.0002
Fetch class attribute name0.00210.147660.0004
XML
Image XML parsing0.00100.069930.0003
class_abstraction
Instantiating content class attribute0.00000.001160.0000
General
dbfile0.00210.1465170.0001
String conversion0.00000.000440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 21
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs