The best way to relate objects?

Author Message

krish harry

Saturday 24 May 2003 1:52:46 am

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?

Jo Henrik Endrerud

Sunday 25 May 2003 1: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

Jo Henrik Endrerud | System Developer @ Seeds Consulting | http://www.seeds.no

krish harry

Sunday 25 May 2003 10:16:50 pm

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

Thomas Thiel

Tuesday 10 June 2003 11:28:25 am

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

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 11:36:17
Script start
Timing: Jan 18 2025 11:36:17
Module start 'layout'
Timing: Jan 18 2025 11:36:17
Module start 'content'
Timing: Jan 18 2025 11:36:17
Module end 'content'
Timing: Jan 18 2025 11:36:17
Script end

Main resources:

Total runtime0.6663 sec
Peak memory usage4,096.0000 KB
Database Queries62

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0067 587.9141152.6250
Module start 'layout' 0.00670.0028 740.539139.4453
Module start 'content' 0.00950.6553 779.9844588.1406
Module end 'content' 0.66470.0015 1,368.125012.1641
Script end 0.6662  1,380.2891 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4922160.0002
Check MTime0.00140.2055160.0001
Mysql Total
Database connection0.00090.139410.0009
Mysqli_queries0.606791.0639620.0098
Looping result0.00060.0916600.0000
Template Total0.631494.820.3157
Template load0.00190.288220.0010
Template processing0.629594.476720.3147
Template load and register function0.00020.023710.0002
states
state_id_array0.00140.213710.0014
state_identifier_array0.00240.360120.0012
Override
Cache load0.00160.2432500.0000
Sytem overhead
Fetch class attribute can translate value0.00130.200530.0004
Fetch class attribute name0.00180.265950.0004
XML
Image XML parsing0.00100.152230.0003
class_abstraction
Instantiating content class attribute0.00000.002350.0000
General
dbfile0.00090.1309160.0001
String conversion0.00000.001240.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
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
10content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
6content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 23
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs