Forums / Developer / The best way to relate objects?

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

eZ debug

Timing: Jan 30 2025 21:14:52
Script start
Timing: Jan 30 2025 21:14:52
Module start 'content'
Timing: Jan 30 2025 21:14:52
Module end 'content'
Timing: Jan 30 2025 21:14:52
Script end

Main resources:

Total runtime0.3559 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0075 587.9297370.2969
Module start 'content' 0.00750.0137 958.22661,005.5156
Module end 'content' 0.02120.3346 1,963.74223,894.4375
Script end 0.3558  5,858.1797 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00421.1924200.0002
Check MTime0.00120.3439200.0001
Mysql Total
Database connection0.00050.146610.0005
Mysqli_queries0.257972.45911410.0018
Looping result0.00190.53631390.0000
Template Total0.334293.910.3342
Template load0.00080.213610.0008
Template processing0.333493.690610.3334
Override
Cache load0.00050.144710.0005
Sytem overhead
Fetch class attribute can translate value0.00160.442610.0016
XML
Image XML parsing0.00020.063510.0002
General
dbfile0.01062.9868200.0005
String conversion0.00000.001130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs