Forums / Setup & design / Question on Object Relation

Question on Object Relation

Author Message

Oliver Weich

Wednesday 26 November 2003 6:47:58 am

Hi Folks,

I've got a little problem with the ObjectRelation Datatype: How do I access the related Object within a template?

I tried the following approach:

{content_view_gui view=line
content_object=fetch(content,object,
hash(object_id, $node.object.data_map.featured_production_item.content.contentobject_id))}

where 'featured_production_item' is the field, which stores the object relation.

I get no output from this. Also I don't know any help, cause documentation on this topic seems to be very rare.

Any sugestions?

Any help would be greatly appreciated!

Cheers

Oliver

EDIT: My Version is 3.2-1 :)

Claus Jensen

Wednesday 26 November 2003 7:06:24 am

Hi Oliver,
If you look in the standard/content/view/full.tpl you see an example of this. Check:

<h2>{"Related objects"|i18n("design/standard/content/view")}</h2>

<table class="list" width="100%" cellspacing="0" cellpadding="0" border="0">
{section name=Object loop=$related_contentobject_array show=$related_contentobject_array sequence=array(bglight,bgdark)}
<tr>
<td class="{$Object:sequence}">
{content_view_gui view=text_linked content_object=$Object:item}
</td>
</tr>
{/section}

regards,
claÜs

Paul Borgermans

Wednesday 26 November 2003 7:10:32 am

This is what I currently use in several templates for full view of classes with keywords:

{let related=$node.object.data_map.keywords.content.related_objects}
{section show=$related}
<h3>Related documents containing one or more of the same keywords</h3>
<ol>
{section name=Related loop=$related}
<li><a href={$:item.url_alias|ezurl}>{$:item.name}</a></li>
{/section}
</ol>
{/section}
{/let}

hth

-paul

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

Oliver Weich

Friday 28 November 2003 3:27:27 am

Thanks! Your help was very useful!

In fact I found a workaround for my Problem by using the embed viewmode. :)

Regards

Oliver