Forums / Developer / Fetch main node ID in relation
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 thisinformation 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
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.