Forums / Developer / Fetch

Fetch

Author Message

Rob Clews

Monday 22 December 2003 6:46:38 am

I have setup a class that includes an Object Relation, how do I find all content that links back to the current object through that relation. For example, if I have an object (a) that is linked to another object (b). How can I show in a template all objects that link to object b?

Cheers,
Rob

Balazs Halasy

Monday 22 December 2003 7:00:06 am

Yes, it is possible.

Let's say that you're viewing a node, in this case you'll have access to the $node variable. From the $node variable you can gain access to the object that this node points to. The object contains info about related objects. The following example template code shows how to get access to the related objects:

{$node.object.related_contentobject_array|attribute(show)}

This will print out info about related objects (if any).

Balazs

Rob Clews

Monday 22 December 2003 8:01:21 am

Thanks,

When viewing object a if I put

{count($node.object.related_contentobject_array)}

in the template that overrides full.tpl then I get 0 the same with object b that it points to.

In the admin the Object Relation shows up fine.

Paul Borgermans

Monday 22 December 2003 11:40:40 am

Hi Balazs

I think Rob means something else: a list of objects that link to the linked object too.

That is currently not possible. Even more, when an object relation is defined as an attribute, the link goes into the attribute values table. The code posted above is for the generic object-object relations instead.

To have that information, one should write either an operator that queries the attribute value table (or the ezcontentobject_link table for generic object-object relations) or add this as a content method to the datatype object relation.

For the datatype object relation list, this involves even XML parsing as far as I understand from the code.

It is an interesting functionality though, as it allows to build "topic maps"

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

Rob Clews

Tuesday 23 December 2003 2:43:33 am

Paul,

Yes that is what I meant, thanks for your insight. I will look into adding an operator if I cannot find a more elegant way of doing what I want to do.

Cheers
Rob

eZ debug

Timing: Jan 18 2025 19:23:39
Script start
Timing: Jan 18 2025 19:23:39
Module start 'content'
Timing: Jan 18 2025 19:23:40
Module end 'content'
Timing: Jan 18 2025 19:23:40
Script end

Main resources:

Total runtime1.0324 sec
Peak memory usage4,096.0000 KB
Database Queries202

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 588.6094180.8594
Module start 'content' 0.00610.8083 769.4688604.0859
Module end 'content' 0.81430.2180 1,373.5547337.3984
Script end 1.0323  1,710.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00470.4574210.0002
Check MTime0.00160.1533210.0001
Mysql Total
Database connection0.00100.096610.0010
Mysqli_queries0.949391.95602020.0047
Looping result0.00240.23512000.0000
Template Total1.001697.020.5008
Template load0.00250.244220.0013
Template processing0.999096.767620.4995
Template load and register function0.00020.015810.0002
states
state_id_array0.00240.229210.0024
state_identifier_array0.00150.140720.0007
Override
Cache load0.00220.2156330.0001
Sytem overhead
Fetch class attribute can translate value0.00120.115740.0003
Fetch class attribute name0.00120.118170.0002
XML
Image XML parsing0.00140.140440.0004
class_abstraction
Instantiating content class attribute0.00000.001270.0000
General
dbfile0.00250.2394340.0001
String conversion0.00000.000830.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/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/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
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 18
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs