Displaying related objects of self-made classes

Author Message

Bjørn Torkel Dahl

Wednesday 02 March 2005 4:45:55 am

Hi all

I cant seem to figure out how to display related objects using an object-relation list.

That is I want to disply the content of reated object in an article, where these objects are either reated within the object relation list or linked from existing objects, and i want it displayed as a part of the current page.

i've found a way to do it hardcoding into the current class' templates, but its ugly.. I'd preffer to user attribute_view_gui or similar, but i cant figure out what to feed as attribute.

Obviously they are not treated as children of the current object, wich would have made it painless, but I see why they are not.

Any ideas?

--
btd

Łukasz Serwatka

Wednesday 02 March 2005 5:06:27 am

Hi Bjørn,

You can view list of related objects to article using attribute_view_gui
For example:

{*img_list is object relation list*}
{attribute_view_gui attribute=$node.object.data_map.img_list}

Look also into design/standard/templates/content/datatype/view/ezobjectrelationlist.tpl to see how it works.

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

Bjørn Torkel Dahl

Wednesday 02 March 2005 6:04:53 am

Hi

Are you saying that a list of related object always will be found in img_list regardless of object class?

--
btd

Gabriel Ambuehl

Wednesday 02 March 2005 6:15:48 am

img_list is the name of his attribute. You must use yours.

Visit http://triligon.org

Bjørn Torkel Dahl

Wednesday 02 March 2005 6:56:28 am

Obviously :) The attribute dumps were quite a lot to read through.

tnx guys.

--
btd

Bjørn Torkel Dahl

Wednesday 02 March 2005 7:28:30 am

And btw, when you include as mentioned over, wich template is used? It does not seem to use the "full" template in my case, I only get a title listing... (i figured this one out.. using "embed" seemed logical, and was, as most of eZ is :>)

That worked ok, but what if the object is just added as a related object? Not in an object relation list, and hence with no name?

--
btd

Roy Bøhmer

Thursday 03 March 2005 11:39:56 pm

I've used object relation list as a way to relate articles. What I found was that when two articles both were related to each other, eZ somehow got a hickup and messed up the whole relation-list.

Ex.:
Article_1 have Article_2 in its object relation list
Aritlce_2 have Article_1 in its object relation list

Have you tested your solution for this?

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.