Fetch main node ID in relation

Author Message

Pål Messenlien

Monday 31 July 2006 12:10:08 pm

I need to fetch the main node ID from a relations datatype in a class. I will use the node id in a def, wich will build up a fetch. Im stuck at this point:

{$node.object.nyhet.object.id} will give me the object id.. this is not enough i need the "main node id"
When i use {$node.nyhet|attribute( show, 1 )} i find the node id is under "main_node_id", but i havent found a way to output this so i can use it in the def.

Any suggestions?

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

Philipp Kamps

Monday 31 July 2006 3:51:59 pm

Hi Pål,

I'm not a 100% sure what exactly the problem is. Maybe this
information helps you:

{def $related_object_node_id = 0 }

{foreach $node.data_map.objectrelations.content.relation_list as $related_object}

   
   {set $related_object_node_id = $related_object.node_id}

   Contains related objects with node_id: {$related_object_node_id}<br />

{/foreach}

So my class has an attribute with the datatype "objectrelationlist" with the name "objectrelations". As you can see, I get all related objects in the foreach-loop.

Each $realted_object is an array with additional information. For example, you can read the "node_id". This node_id is always the main_node_id.

Let me know if this feedback helps or if you need more information.

Regards

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

Pål Messenlien

Wednesday 02 August 2006 12:44:01 am

Thanks alot.. that did just the trick i needed. Im using this to build a news fetch so i can sort things just the way i want.

--------------------------------------------
Høgskolen i Lillehammer
Lillehammer University College
http://www.hil.no
--------------------------------------------
Messenlien IT
http://messenlien.com
-------------------------------------------

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 30 2025 21:40:32
Script start
Timing: Jan 30 2025 21:40:32
Module start 'layout'
Timing: Jan 30 2025 21:40:32
Module start 'content'
Timing: Jan 30 2025 21:40:32
Module end 'content'
Timing: Jan 30 2025 21:40:32
Script end

Main resources:

Total runtime0.0220 sec
Peak memory usage4,096.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0053 588.1328151.2109
Module start 'layout' 0.00530.0038 739.3438220.6875
Module start 'content' 0.00900.0117 960.0313997.9141
Module end 'content' 0.02070.0013 1,957.945333.9922
Script end 0.0220  1,991.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002511.2331140.0002
Check MTime0.00104.5417140.0001
Mysql Total
Database connection0.00083.604410.0008
Mysqli_queries0.003114.177230.0010
Looping result0.00000.041110.0000
Template Total0.00094.110.0009
Template load0.00073.192010.0007
Template processing0.00020.916810.0002
Override
Cache load0.00052.184310.0005
General
dbfile0.00125.596080.0002
String conversion0.00000.021640.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