Forums / Developer / Link to the related object attribute.
Salvatore Guarino
Wednesday 31 January 2007 8:07:25 am
Hi. I have a class with a related object attribute. Now I want to create, in the full template of this class, a link to open in his full template the related object, for example a video.
Something like this:
<a href="{$node.object.data_map.related_video.???|maybe_a_ezurl_function???}"
Any ideas?
Bye,
SG
André R.
Wednesday 31 January 2007 8:18:06 am
if it is object relation:
{if $node.data_map.related_video.has_content} <a href={$node.data_map.related_video.content.main_node.url_alias|ezurl}>{$node.data_map.related_video.content.name|wash}</a>
* node.data_map is shortcut for node.object.data_map * unless you specify anything, ezurl will create the "" for you * to find out things like this yourself, you could use {$node.object.data_map.related_video.content|attribute('show', 1)}, where 1 is the number of sub levels you want to print out.* the content of $node.data_map.related_video.content is the object that is related and not the node, that's why I use main_node to get the main_node the object belongs to
If it is object relations:
{if $node.data_map.related_video.has_content} {foreach $node.data_map.related_video.content.relation_list as $element} <a href={$element.main_node.url_alias|ezurl}>{$element.name|wash}</a>
eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription @: http://twitter.com/andrerom
Wednesday 31 January 2007 11:27:38 pm
Thank you very much!
Salvatore