This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Developer » The best way to relate objects?
expandshrink

The best way to relate objects?

The best way to relate objects?

Saturday 24 May 2003 10:52:46 am - 3 replies

Why we are not able to relate multipe objects using "Object relation" datatype? Or am i missing something?

Because of the above making a simple structure like below is cubersome:
Class Course
related instructors
related courses
related schedules
end

We cannot use the built in related object functionality as it invovels double work -- first selecting objects and then putting in xml text field.

I am wondering if you guys are not facing this difficulty of "Object relation" datatype accepting only one object. Also then what other best way you have achieved solution to this?

Sunday 25 May 2003 10:16:12 pm

The Object Relation datatype meant to be used the times you need to force the author to relate another object (or by adding more of this attribute, deveral objects).

The way we solve your problem is by using th enormal related object functionality. If you don't want to make the user add the objects without making them put the text in the xml field you should modify the template to present the related objects in the way you want to present them. Then you can make lists with your related objects without them having to be added in the xml text field

Monday 26 May 2003 7:16:50 am

Thats a very good idea. Thanks.

Linking different types of multiple objects through different "Object relation" attributes would have been much better as it would bifergate the different types of relations. But your idea is also good.

Does anybody know the sample of template code for viewing all the related objects (linked through built-in related object functionality) ?

Also for viewing only the related objects of specific class?

tx
krish

Tuesday 10 June 2003 8:28:25 pm

Hi,

maybe here is something whats in your mind:

http://www.radiologie-weinheim.de/content/view/full/93/

I made a custom folder and an custom article-class to show the content the way it does. together with some css-magic its displaying this way. build an override-template for the specific custom folder:

{default with_children=true()}
{let list_count=and($with_children,fetch('content','list_count',hash(parent_node_id,$node.node_id)))}

{default content_object=$node.object
content_version=$node.contentobject_version_object}

<table class="linklist" width="100%" cellpadding="3" cellspacing="3" border="0">
<tr>
<th style="border: thin solid black;" align="left">Untersuchung</th><th align="left" style="border: thin solid black;">Anmeldung</th><th align="left" style="border: thin solid black;">Vorbereitung</th><th align="left" style="border: thin solid black;">Dauer(in Minuten)</th>
</tr>
{let name=Child
children=fetch('content','list',hash(parent_node_id, $node.node_id, sort_by, array(array(priority))))}
{section loop=$:children sequence=array(bglight,bgdark)}
<tr>
{node_view_gui view=line content_node=$Child:item}
</tr>
{/section}
</table>

{/let}
{/default}
{/let}
{/default}

I'm sure it can be done in a more elegant way. a big problem is that the template is incredible slow if there is no object relation defined. but i think one can use the new is_empty-function to solve this pitfall. btw: does anybody have an idea how the table-rows can be showed bglight-bgdark ? did not solve this problem with the above stated code.

Regards, Thomas

Modified on Tuesday 10 June 2003 8:34:01 pm by Thomas Thiel

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from