Fetching Object Relations

Author Message

Sandeep Kadam

Tuesday 29 June 2010 2:29:11 am

Hi All,
I Have a class named "Guest room" in which i have used attribute name "Masthead Images" of type "Object relations" as a container for rotation images on my web pages...
I have uploaded images in Media Library/Images folder.
and added that images as an "add objects" for "Masthead Images" attribute in "Guest room" class object.
What i need is to fetch url of that images so that i can use it in script for rotation..
Please let me know if i need to explain more about my requirement.. Please some one help me in this.. please
Thank you ,
Sandeep

Ivo Lukac

Wednesday 30 June 2010 2:35:08 am

Use something like this. Writing from my memory, so check syntax :)

{def $relnode}
{foreach $node.data_map.masthead_images.content.relation_list as $rel}
 {set $relnode = fetch(content, node, hash(node_id, $rel.node_id))}
 <img src="{$relnode.data_map.image.content[original].full_path|ezroot}"/>
{/foreach}
{undef $relnode}

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Sandeep Kadam

Wednesday 30 June 2010 4:12:19 am

HI Ivo Lukac,

Thank you very much this realy is the code which i required. And I got it done.
Thanks..........Cheerssssss :)

Sandeep

Simon Boyer

Wednesday 13 July 2011 8:02:12 am

Hi,

I added an extension to do this :

http://projects.ez.no/oworfilter

This extension provides an extended attribute filter to fetch by object relation(s).

--
Developer at Open Wide

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 02:04:44
Script start
Timing: Jan 18 2025 02:04:44
Module start 'layout'
Timing: Jan 18 2025 02:04:44
Module start 'content'
Timing: Jan 18 2025 02:04:45
Module end 'content'
Timing: Jan 18 2025 02:04:45
Script end

Main resources:

Total runtime0.7118 sec
Peak memory usage4,096.0000 KB
Database Queries63

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0061 587.9141152.6250
Module start 'layout' 0.00610.0036 740.539139.4453
Module start 'content' 0.00970.7006 779.9844604.9141
Module end 'content' 0.71030.0015 1,384.898412.1641
Script end 0.7118  1,397.0625 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00330.4582160.0002
Check MTime0.00140.1965160.0001
Mysql Total
Database connection0.00090.127310.0009
Mysqli_queries0.650991.4332630.0103
Looping result0.00070.0997610.0000
Template Total0.675794.920.3378
Template load0.00170.245820.0009
Template processing0.673994.668520.3369
Template load and register function0.00010.015010.0001
states
state_id_array0.00120.175310.0012
state_identifier_array0.00370.521820.0019
Override
Cache load0.00150.2161340.0000
Sytem overhead
Fetch class attribute can translate value0.00100.137030.0003
Fetch class attribute name0.00130.176170.0002
XML
Image XML parsing0.00180.247530.0006
class_abstraction
Instantiating content class attribute0.00000.002580.0000
General
dbfile0.00130.1872290.0000
String conversion0.00000.005240.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
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
4content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
3content/datatype/view/ezxmltags/strong.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/strong.tplEdit templateOverride template
6content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 26
 Number of unique templates used: 9

Time used to render debug report: 0.0002 secs