Forums / Setup & design / Displaying related objects of self-made classes

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?

eZ debug

Timing: Jan 30 2025 00:58:49
Script start
Timing: Jan 30 2025 00:58:49
Module start 'content'
Timing: Jan 30 2025 00:58:49
Module end 'content'
Timing: Jan 30 2025 00:58:49
Script end

Main resources:

Total runtime0.2795 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 588.0781180.8125
Module start 'content' 0.00730.0081 768.8906102.0547
Module end 'content' 0.01540.2640 870.9453530.6250
Script end 0.2794  1,401.5703 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00331.1783200.0002
Check MTime0.00130.4797200.0001
Mysql Total
Database connection0.00070.265910.0007
Mysqli_queries0.229282.00821410.0016
Looping result0.00130.46871390.0000
Template Total0.263694.310.2636
Template load0.00080.276610.0008
Template processing0.262894.024910.2628
Override
Cache load0.00050.192110.0005
Sytem overhead
Fetch class attribute can translate value0.00070.248310.0007
XML
Image XML parsing0.00030.093410.0003
General
dbfile0.01134.0445200.0006
String conversion0.00000.002130.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