Parent Node ID

Author Message

Christoph Schneider

Wednesday 29 January 2003 11:25:05 am

How do I get the node ID of the parent node of the current node?

I want to achieve the following:
In a full view template of an article, I want to show "related articles", ie. articles about the same topic. The "topic" is the parent node of the articles, so I want a list of all children for the parent node of the current node (current article).

fetch(content,list,hash(parent_node_id,[...insert statement here...]))

Bruce Morrison

Wednesday 29 January 2003 6:42:30 pm

> How do I get the node ID of the parent node of the current
> node?
>
> I want to achieve the following:
> In a full view template of an article, I want to show
> "related articles", ie. articles about the same topic. The
> "topic" is the parent node of the articles, so I want a list
> of all children for the parent node of the current node
> (current article).
>
> fetch(content,list,hash(parent_node_id,[...insert statement
> here...]))

$node.parent_node_id

is what you are looking for

bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Christoph Schneider

Monday 03 February 2003 2:25:27 am

Thank you, Bruce.
In addition, I found the following message very helpful... so if anyone has a similar problem:
http://developer.ez.no/forum/message/14007/

Bruce Morrison

Monday 03 February 2003 8:47:04 pm

> Thank you, Bruce.
> In addition, I found the following message very helpful...
> so if anyone has a similar problem:
> http://developer.ez.no/forum/message/14007/

Of interest to get the grandparent id
{$node.parent.parent_node_id}

Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Alexei Pechekhonov

Tuesday 04 February 2003 7:58:03 am

> > so if anyone has a similar problem:

> Of interest to get the grandparent id
> {$node.parent.parent_node_id}
>
> Bruce
Really nice solution.
But i meet another strange effect.
Yes, I can see $node.node_id, $node.parent_node_id etc... - BUT ! only first time , before cache wasn't created.
I have to clean cache for correct reflection and on second and next times i have nothing till the cache will be cleaned again .
(winXP, ProcessCaching=disabled)
Did you have the same thing ?

Bruce Morrison

Monday 17 February 2003 9:49:57 pm

> > > so if anyone has a similar problem:
>
> > Of interest to get the grandparent id
> > {$node.parent.parent_node_id}
> >
> > Bruce
> Really nice solution.
> But i meet another strange effect.
> Yes, I can see $node.node_id, $node.parent_node_id etc... -
> BUT ! only first time , before cache wasn't created.
> I have to clean cache for correct reflection and on second
> and next times i have nothing till the cache will be cleaned
> again .
> (winXP, ProcessCaching=disabled)
> Did you have the same thing ?

Am seeing this now that I have turned on caching. It seems that the $node variable is not availaiable to the cached page.

Did you find a solution to this?

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Paul Borgermans

Tuesday 18 February 2003 2:40:37 am

> > > > so if anyone has a similar problem:
> >
> > > Of interest to get the grandparent id
> > > {$node.parent.parent_node_id}
> > >
> > > Bruce
> > Really nice solution.
> > But i meet another strange effect.
> > Yes, I can see $node.node_id, $node.parent_node_id etc...
> -
> > BUT ! only first time , before cache wasn't created.
> > I have to clean cache for correct reflection and on
> second
> > and next times i have nothing till the cache will be
> cleaned
> > again .
> > (winXP, ProcessCaching=disabled)
> > Did you have the same thing ?
>
> Am seeing this now that I have turned on caching. It seems
> that the $node variable is not availaiable to the cached
> page.
>
> Did you find a solution to this?
>
> Cheers
> Bruce

You can use the {$module_result.node_id} for fetch functions. This will also work on cached pages.

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

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 18 2025 11:22:04
Script start
Timing: Jan 18 2025 11:22:04
Module start 'layout'
Timing: Jan 18 2025 11:22:04
Module start 'content'
Timing: Jan 18 2025 11:22:05
Module end 'content'
Timing: Jan 18 2025 11:22:05
Script end

Main resources:

Total runtime0.6628 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0071 590.4297152.6250
Module start 'layout' 0.00710.0030 743.054739.4453
Module start 'content' 0.01010.6510 782.5000669.1328
Module end 'content' 0.66120.0016 1,451.632820.8047
Script end 0.6627  1,472.4375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4928160.0002
Check MTime0.00140.2071160.0001
Mysql Total
Database connection0.00210.312810.0021
Mysqli_queries0.577987.1951730.0079
Looping result0.00080.1176710.0000
Template Total0.624594.220.3122
Template load0.00280.428220.0014
Template processing0.621693.787620.3108
Template load and register function0.00040.066210.0004
states
state_id_array0.00080.121610.0008
state_identifier_array0.00080.125520.0004
Override
Cache load0.00220.32761000.0000
Sytem overhead
Fetch class attribute can translate value0.00080.114740.0002
Fetch class attribute name0.00110.165990.0001
XML
Image XML parsing0.00130.191640.0003
class_abstraction
Instantiating content class attribute0.00000.0033110.0000
General
dbfile0.00100.1521230.0000
String conversion0.00000.001040.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
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
9content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/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: 33
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs