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.

eZ debug

Timing: Jan 18 2025 11:16:08
Script start
Timing: Jan 18 2025 11:16:08
Module start 'layout'
Timing: Jan 18 2025 11:16:08
Module start 'content'
Timing: Jan 18 2025 11:16:09
Module end 'content'
Timing: Jan 18 2025 11:16:09
Script end

Main resources:

Total runtime1.2183 sec
Peak memory usage4,096.0000 KB
Database Queries73

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0049 588.0469152.6406
Module start 'layout' 0.00490.0029 740.687539.4922
Module start 'content' 0.00781.2090 780.1797658.5469
Module end 'content' 1.21680.0015 1,438.726616.1250
Script end 1.2183  1,454.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00340.2786160.0002
Check MTime0.00140.1172160.0001
Mysql Total
Database connection0.00090.075610.0009
Mysqli_queries1.149994.3876730.0158
Looping result0.00070.0561710.0000
Template Total1.183497.120.5917
Template load0.00230.189420.0012
Template processing1.181096.939420.5905
Template load and register function0.00020.013510.0002
states
state_id_array0.00150.126510.0015
state_identifier_array0.00150.122120.0007
Override
Cache load0.00200.1601370.0001
Sytem overhead
Fetch class attribute can translate value0.00120.102140.0003
Fetch class attribute name0.00090.076890.0001
XML
Image XML parsing0.00310.251140.0008
class_abstraction
Instantiating content class attribute0.00000.0019120.0000
General
dbfile0.00370.3049240.0002
String conversion0.00000.000640.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
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/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
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 27
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs