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

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 19 2025 07:13:36
Script start
Timing: Jan 19 2025 07:13:36
Module start 'layout'
Timing: Jan 19 2025 07:13:36
Module start 'content'
Timing: Jan 19 2025 07:13:37
Module end 'content'
Timing: Jan 19 2025 07:13:37
Script end

Main resources:

Total runtime0.8873 sec
Peak memory usage4,096.0000 KB
Database Queries54

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0066 589.3984152.6563
Module start 'layout' 0.00660.0029 742.054739.5078
Module start 'content' 0.00950.8766 781.5625533.0078
Module end 'content' 0.88610.0011 1,314.57038.1094
Script end 0.8873  1,322.6797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.3771160.0002
Check MTime0.00130.1497160.0001
Mysql Total
Database connection0.00090.104610.0009
Mysqli_queries0.841294.8079540.0156
Looping result0.00070.0735520.0000
Template Total0.857496.620.4287
Template load0.00200.224320.0010
Template processing0.855496.407520.4277
Template load and register function0.00010.009510.0001
states
state_id_array0.00070.082910.0007
state_identifier_array0.00080.095120.0004
Override
Cache load0.00170.1862210.0001
Sytem overhead
Fetch class attribute can translate value0.00070.082620.0004
Fetch class attribute name0.00130.145540.0003
XML
Image XML parsing0.00100.107420.0005
class_abstraction
Instantiating content class attribute0.00000.000940.0000
General
dbfile0.00180.1998210.0001
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs