Object relations

Author Message

j jevack

Thursday 27 October 2005 3:15:56 am

Can someone provide a 'real world' example of using the object relation feature? I have read the eZ publish book as well as the online docs. I don't quite understand how to put it to use.

If it's not obvious, I'm a new eZ publish user. I'm building a website with eZ 3.7

Thank you,

Jason

Ɓukasz Serwatka

Thursday 27 October 2005 3:48:11 am

Hi Jason,

Where is exacly problem?

Most typical is relation on the same topic level. So if you have News section in your website, you can use object relation list datatype as additional attribute in article class and relate with news other objects around the same topic.

Lets say that we have News about eZ publish, so using object relation datatype you can relate with this news other articles about eZ publish On-line editor.
Links to releated content you present like:
See also:
- related article 1
- related article 2
- related article 3

Object relations is one of most powerful features of eZ publish.

Hope this will give you some light ;)

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

j jevack

Thursday 27 October 2005 4:05:59 am

Greetings Lukasz,

If I understand correctly, once I have a news article that is related to other news articles, I can use the template language to discover the relations and provide my users with a list of those relations.

Regards,

Jason

j jevack

Thursday 27 October 2005 7:25:47 am

How is the reverse object relation used?

John Mina

Sunday 05 March 2006 6:06:47 am

Hi,
the example explained above is very easy and nice,
Now i was trying to do fetching to all articles children of current node.
And if any of them has a related article attached to it, i want to show a link to it on the front page.

But I failed doing that.
here is my code

 {section var=a loop=$ar}
				      <h2><a href={$a.url_alias|ezurl}>{$a.name}</a></h2>
							<p><a href={$a.url_alias|ezurl}><img src={$a.data_map.folder_pic.content.medium.url|ezroot} width="95px" border="0" align="right" hspace="3px"></a>{$a.data_map.intro.content.output.output_text}</p>
			

					{let related_objects=$a.data_map.related_contentobject_array}
					 {section show=$related_objects}
		 			 <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>
                      {/let}
	
				 {/section}

Can any one help ?

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 11:44:01
Script start
Timing: Jan 19 2025 11:44:01
Module start 'layout'
Timing: Jan 19 2025 11:44:01
Module start 'content'
Timing: Jan 19 2025 11:44:03
Module end 'content'
Timing: Jan 19 2025 11:44:03
Script end

Main resources:

Total runtime1.9876 sec
Peak memory usage4,096.0000 KB
Database Queries65

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0128 589.0547152.6094
Module start 'layout' 0.01280.0053 741.664139.4141
Module start 'content' 0.01811.9680 781.0781595.7422
Module end 'content' 1.98610.0015 1,376.820312.1875
Script end 1.9875  1,389.0078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00390.1981160.0002
Check MTime0.00140.0719160.0001
Mysql Total
Database connection0.00130.066610.0013
Mysqli_queries1.918896.5373650.0295
Looping result0.00080.0422630.0000
Template Total1.907596.020.9538
Template load0.00320.160520.0016
Template processing1.904395.809520.9522
Template load and register function0.00030.014710.0003
states
state_id_array0.00400.199610.0040
state_identifier_array0.00310.155020.0015
Override
Cache load0.00240.1188360.0001
Sytem overhead
Fetch class attribute can translate value0.00090.043730.0003
Fetch class attribute name0.00120.062560.0002
XML
Image XML parsing0.00080.037830.0003
class_abstraction
Instantiating content class attribute0.00000.000660.0000
General
dbfile0.00090.0462180.0001
String conversion0.00000.000640.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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/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: 20
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs