Forums / Developer / Fetching Object Relations

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

eZ debug

Timing: Jan 29 2025 13:37:39
Script start
Timing: Jan 29 2025 13:37:39
Module start 'content'
Timing: Jan 29 2025 13:37:39
Module end 'content'
Timing: Jan 29 2025 13:37:39
Script end

Main resources:

Total runtime0.0205 sec
Peak memory usage2,048.0000 KB
Database Queries4

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0065 587.9297180.8359
Module start 'content' 0.00650.0060 768.765698.4922
Module end 'content' 0.01250.0080 867.257874.7031
Script end 0.0204  941.9609 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002511.9675120.0002
Check MTime0.00125.7612120.0001
Mysql Total
Database connection0.00083.752110.0008
Mysqli_queries0.002411.486440.0006
Looping result0.00000.067420.0000
Template Total0.007436.210.0074
Template load0.00104.980410.0010
Template processing0.006431.167410.0064
Override
Cache load0.00073.431410.0007
General
dbfile0.003416.7457100.0003
String conversion0.00000.025630.0000
Note: percentages do not add up to 100% because some accumulators overlap

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