Forums / General / How to display related content?

How to display related content?

Author Message

John Bett

Thursday 27 August 2009 10:46:37 am

Hello

I have a related content object. It shows up in the Relations table. How do I print this to the screen from my override template?

I'm running eZpublish version 4.

Robin Muilwijk

Sunday 06 September 2009 12:02:02 am

Hi John,

The only thing I could find on the documentation pages was the following: http://ez.no/doc/ez_publish/technical_manual/4_x/reference/datatypes/keywords

You got me curious, so I'm looking around a bit more for a full example. If I find something, i'll be sure to post that here also.

Regards Robin

Edit1: I found some more links to resources here: http://ezpedia.org/en/ez/related_objects
Edit2: http://ezpedia.org/en/snippet/template_logic_to_fetch_using_an_attribute_filter_using_the_like_condition

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Łukasz Serwatka

Monday 07 September 2009 12:38:12 am

Hi,

Keyword related content you can access on attribute level like:

{foreach $node.data_map.KEYWORD_ATTR_NAME.content.related_objects as $related_object}
    <a href="{$related_object.url_alias|ezurl( 'no' )}" title="{$related_object.name|wash()}">{$related_object.name|wash()}</a><br />
{/foreach}

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Robin Muilwijk

Monday 07 September 2009 11:43:19 am

Hi Łukasz,

The code you share, where would one put that, in a template file? I'm still a bit of an eZ noob, trying to learn more.

Thanks, Robin

Board member, eZ Publish Community Project Board - Member of the share.ez.no team - Key values: Openness and Innovation.

LinkedIn: http://nl.linkedin.com/in/robinmuilwijk // Twitter: http://twitter.com/i_robin // Skype: robin.muilwijk

Łukasz Serwatka

Monday 07 September 2009 1:55:51 pm

Hi,

Yes, you have to put that code in template. Remember replace KEYWORD_ATTR_NAME with attribute identifier which is a Keyword datatype.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

John Moritz

Friday 11 September 2009 2:22:38 pm

I was searchin for a similar solution.
Found out that i can get related content with:

{def $node_of_related_content = $node.object.data_map.YOUR_IDENTIFIER.content.relation_list.0.node_id}
{def $related_content=fetch( 'content', 'node', hash( 'node_id', $node_of_related_content ) )}
{$related_content.name}

With this you can also reach the data_map of the related content with $related_content.data_map.

razibur rahman

Friday 25 September 2009 4:19:46 am

To make it as simple as possible to find the desired content in Internet typically "related content" is shown in the context of a given topic. So context dependent contact information, related products, further news and downloads can be better found by users and visitors.
The SharePoint Content Relationship Management System by Layer2 enables editors to define relationships between SharePoint items and documents and provides a very flexible way, to display related content using the SharePoint Related Content Web Part.
SharePoint Related Content Web Part - Overview

* Features & benefits
* Free registration and evaluation download
* How to buy this product
* FAQs
* Product description

Features & Benefits

To make it as simple as possible to find the desired content in Internet typically "related content" is shown in the context of a given topic. So context dependent contact information, related products, further news and downloads can be better found by users and visitors.The SharePoint Content Relationship Management System by Layer2 enables editors to define relationships between SharePoint items and documents and provides a very flexible way, to display related content using the SharePoint Related Content Web Part.

[URL=http://kerjakeras.com/mengembalikan-jati-diri-bangsa/]Mengembalikan Jati Diri Bangsa[/URL]|
[URL=http://kerjakeras.com/kenali-dan-kunjungi-objek-wisata-di-pandeglang/]Kenali Dan Kunjungi Objek Wisata Di Pandeglang[/URL]

eZ debug

Timing: Jan 18 2025 10:28:05
Script start
Timing: Jan 18 2025 10:28:05
Module start 'content'
Timing: Jan 18 2025 10:28:05
Module end 'content'
Timing: Jan 18 2025 10:28:05
Script end

Main resources:

Total runtime0.1633 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.8359180.8438
Module start 'content' 0.00550.0046 769.6797101.9609
Module end 'content' 0.01010.1531 871.6406529.7734
Script end 0.1632  1,401.4141 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00321.9807200.0002
Check MTime0.00130.8258200.0001
Mysql Total
Database connection0.00060.368110.0006
Mysqli_queries0.120073.51021410.0009
Looping result0.00130.78871390.0000
Template Total0.152793.610.1527
Template load0.00080.509110.0008
Template processing0.151993.043910.1519
Override
Cache load0.00060.345510.0006
Sytem overhead
Fetch class attribute can translate value0.00130.798110.0013
XML
Image XML parsing0.00040.218010.0004
General
dbfile0.00161.0063200.0001
String conversion0.00000.003730.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0002 secs