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]

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 18 2025 15:12:06
Script start
Timing: Jan 18 2025 15:12:06
Module start 'layout'
Timing: Jan 18 2025 15:12:06
Module start 'content'
Timing: Jan 18 2025 15:12:06
Module end 'content'
Timing: Jan 18 2025 15:12:06
Script end

Main resources:

Total runtime0.0153 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0052 587.9063152.6250
Module start 'layout' 0.00520.0029 740.531339.4453
Module start 'content' 0.00810.0050 779.976697.4141
Module end 'content' 0.01310.0021 877.390642.3047
Script end 0.0152  919.6953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002717.4549140.0002
Check MTime0.00128.1189140.0001
Mysql Total
Database connection0.00095.577010.0009
Mysqli_queries0.002617.014930.0009
Looping result0.00000.098310.0000
Template Total0.001711.410.0017
Template load0.00095.622210.0009
Template processing0.00095.726810.0009
Override
Cache load0.00064.083610.0006
General
dbfile0.00021.459080.0000
String conversion0.00000.045340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

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

Time used to render debug report: 0.0001 secs