Forums / Setup & design / Object relations

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 ?