Forums / Setup & design / How to display related objects in pagelayout template?

How to display related objects in pagelayout template?

Author Message

Jack Rackham

Wednesday 13 October 2004 5:21:50 am

I have a problem displaying the related objects of an article in a pagelayout template. The following code works in a ‘normal template’ but not in a pagelayout template.

{let related_objects=$module_result.node_id.object.related_contentobject_array}
{section show=$related_objects}

<div class="relatedarticles">
<h2>{"R"|i18n("design/magasinet/layout")}</h2>
<ul>
{section name=ContentObject loop=$related_objects show=$related_objects}
<li><a href={$ContentObject:item.main_node.url_alias|ezurl}>{$ContentObject:item.name}</a></li>
{/section}
</ul>
</div>
{/section}
{/let}

Mark Marsiglio

Wednesday 13 October 2004 6:12:15 am

I had used this code in a 3.2 installation, but it probably would have to be revised for 3.4 or 3.5. Maybe it can provide some clues...

{let related=$node.object.data_map.keywords.content.related_objects}
{section show=$related}

 {switch match=$related}
 {case match=''}

 {/case}
 {case}
<h3>Related documents</h3> 
{/case}
 {/switch}
<ol>
{section name=Related loop=$related}
<li class="relateditem"><a href={$:item.url_alias|ezurl}>{$:item.name}</a> <span class="relateditemclass"><nobr>{$node.object.class_name|wash}</nobr></span></li>
{/section}
</ol>
{/section}
{/let}

http://www.thinkcreative.com
Turning Ideas Into Strategic Solutions