get embedded image in short_description

Author Message

paul bolger

Wednesday 01 June 2011 5:52:45 am

I need to pull an image in the short_description field in a folder. If I use

$child.object.data_map.short_description.object.embedded_contentobject_array.0.current.data_map.image

I seem to get all the embedded objects for the object rather than just the ones in short_description - and in no particular order. How do I call just one field?

Paul Bolger

Peter Keung

Wednesday 01 June 2011 7:28:43 am

Try using the related_objects fetch and specifying an attribute:

http://doc.ez.no/eZ-Publish/Technical-manual/4.x/Reference/Modules/content/Fetch-functions/related_objects

http://www.mugo.ca
Mugo Web, eZ Partner in Vancouver, Canada

paul bolger

Thursday 02 June 2011 6:46:58 pm

Thanks Peter, I'll give that a try.

Seems a bit crazy that you can't directly get the embedded objects out of a particular xml field. Has this changed since 3.x? I used the line above in a project a few years ago (3.8) and it seemed to work ok then.

Paul Bolger

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 29 2025 14:43:25
Script start
Timing: Jan 29 2025 14:43:25
Module start 'layout'
Timing: Jan 29 2025 14:43:25
Module start 'content'
Timing: Jan 29 2025 14:43:25
Module end 'content'
Timing: Jan 29 2025 14:43:25
Script end

Main resources:

Total runtime0.0165 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0055 588.2266151.2109
Module start 'layout' 0.00550.0022 739.437536.6563
Module start 'content' 0.00770.0067 776.093890.0469
Module end 'content' 0.01440.0021 866.140633.9766
Script end 0.0165  900.1172 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002414.7420140.0002
Check MTime0.00116.9240140.0001
Mysql Total
Database connection0.00127.359510.0012
Mysqli_queries0.002213.337630.0007
Looping result0.00000.079310.0000
Template Total0.00137.610.0013
Template load0.00105.835410.0010
Template processing0.00031.754810.0003
Override
Cache load0.00073.973910.0007
General
dbfile0.002716.358380.0003
String conversion0.00000.043340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_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