Forums / Developer / How to list a object relation list

How to list a object relation list

Author Message

Werner Klausen

Monday 02 May 2005 12:36:46 am

Hi, I've browsed the forum now for quite a while, but none of the other posts about this topic seems to do the trick, but I'm sure the answer is quite simple :)

I have a custommade class called <i>mainmenu</i> (node 102). This have the attributes <i>name</i> and <i>elements</i>. The attribute <i>elements</i> is a object relation list.

Now what i want is to somehow fetch the content of <i>elements</i> and display it to screen (and use it as a menu).

Now I think I've understanded that attribute_view_gui should maybe be used, but I just can't seem to get it to work.

Thanks :)

ADDON: I would like to go through the object list using a loop, as I want to put one and one list into a <li> element.

Because I can!

Felix Laate

Monday 02 May 2005 12:59:29 am

Hi Werner!

I've done this with:

{*related is object relation list*}
{attribute_view_gui attribute=$node.object.data_map.related}

(in the full override for the class in question)

If you want to do a manual loop, you could perhaps do this:

{section name=myLoop loop=$node.object.data_map.related}
<li>$myLoop:item.blablabla</li>
{/section}

Felix

Publlic Relations Manager
Greater Stavanger
www.greaterstavanger.com

Werner Klausen

Monday 02 May 2005 1:19:05 am

Thanks for the reply Felix!

I probably should have stated that I'm very new to eZ, but I understood that I needed more code than that. :)

This is now what I got semi working:

<ul>
{let attribute=fetch( 'content', 'node', hash( 'node_id', 102 ))}
{*elementer is object relation list*}
{attribute_view_gui attribute=$attribute.object.data_map.elementer}
{/let}
</ul>

For some reston I had to change <i>node</i> to <i>attribute </i> in $node.object.data_map.elementer to get it to list anything. However, I did not get the loop to work. And in addition it's listing out all the childnodes that each object-relation got.

eZ template language is very confusing atm :)

Because I can!

Werner Klausen

Monday 02 May 2005 3:37:56 am

Ok, now I got it to list one and one item of the object relation list, just thought I'd show how in case others might find it useful:

<ul>
{let menu=fetch( 'content', 'node', hash( 'node_id', 102 )) }
{section var=Relations loop=$menu.object.data_map.elementer.content.relation_list}
<li>
{content_view_gui view=text content_object=fetch( content, object,
hash( object_id, $Relations.item.contentobject_id ))}
</li>
{/section}
{/let}
</ul>

Now all I need is to make links of these somehow so that they link to the actual object that they are :)

Because I can!

Werner Klausen

Monday 02 May 2005 3:49:32 am

view=text_linked

:) I Suppose this thread is now ended for my part.

Because I can!

eZ debug

Timing: Jan 18 2025 15:10:07
Script start
Timing: Jan 18 2025 15:10:07
Module start 'content'
Timing: Jan 18 2025 15:10:08
Module end 'content'
Timing: Jan 18 2025 15:10:08
Script end

Main resources:

Total runtime1.2903 sec
Peak memory usage4,096.0000 KB
Database Queries200

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0087 588.8516180.8281
Module start 'content' 0.00871.1254 769.6797570.1797
Module end 'content' 1.13410.1561 1,339.8594337.3672
Script end 1.2902  1,677.2266 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.3304210.0002
Check MTime0.00150.1125210.0001
Mysql Total
Database connection0.00140.107510.0014
Mysqli_queries1.204393.33322000.0060
Looping result0.00250.19671980.0000
Template Total1.254697.220.6273
Template load0.00210.166120.0011
Template processing1.252597.067220.6262
Template load and register function0.00010.010810.0001
states
state_id_array0.00140.106010.0014
state_identifier_array0.00150.118320.0008
Override
Cache load0.00180.1406360.0001
Sytem overhead
Fetch class attribute can translate value0.00120.095630.0004
Fetch class attribute name0.00120.095470.0002
XML
Image XML parsing0.00110.082030.0004
class_abstraction
Instantiating content class attribute0.00000.0016100.0000
General
dbfile0.00230.1779300.0001
String conversion0.00000.001530.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
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
5content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs