Forums / Setup & design / how to get data from object within pagelayout template?

how to get data from object within pagelayout template?

Author Message

Matt Gifford

Saturday 26 July 2008 8:49:47 am

Hi guys

I am adapting the pagelayout template, as I need a banner object (as in the default frontpage template) to be show in all pages.

I have the standard banner code:

{if $node.object.data_map.billboard.has_content}
<div class="attribute-billboard">
{content_view_gui view=billboard content_object=$node.object.data_map.billboard.content}
</div>
{/if}

From what I can see though, the pagelayout template does not have the $node variable.
How can I access this?

I am seeing the current node ID from the pagelayout template ($current_node_id) which is fine, but I really need to access the object data map to get the billboard.

Any ideas?
Your help would be fantastic.

Many thanks,

Matt

Greg McAvoy-Jensen

Saturday 26 July 2008 9:08:02 am

You'll need to do a fetch, like:

{def $my_node=fetch( 'content', 'node', hash( 'node_id', $module_result.node_id ) )}

$my_node will then have your billboard.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

Matt Gifford

Saturday 26 July 2008 9:15:23 am

Greg, thank you so much. You are a legend. :)

Matt Gifford

Wednesday 30 July 2008 4:46:38 am

Hi guys

I'm now trying to extract the url to the image supplied by the banner I have uploaded.

Using the {content_view_gui view=billboard content_object=$node.object.data_map.headerimage.content} method brings back the complete img src tag.

Does anyone know how I can get to just the location/url of the image?

Many thanks,

Matt

Norman Leutner

Wednesday 30 July 2008 6:25:19 am

Hi,

try {$node.object.data_map.headerimage|attribute(show)} to get more information...

Mit freundlichen Grüßen
Best regards

Norman Leutner

____________________________________________________________
eZ Publish Platinum Partner - http://www.all2e.com
http://ez.no/partners/worldwide_partners/all2e_gmbh

Matt Gifford

Wednesday 30 July 2008 7:24:16 am

Thanks Norman

I get the following returned. I'm still a little confused by it though.

Attribute Type Value

name object[eZContentObjectAttribute]

>id string 1189
>contentobject_id string 190
>version string 1

How can I get the URL from this?

Many thanks,

Matt

Pascal von Büren

Wednesday 30 July 2008 7:36:56 am

Hi Matt,

use something like this:

$node.data_map.headerimage.content.original.full_path

You can also replace the "original" part in the above by any image variation you have defined in your image.ini.append (e.g. medium).

Matt Gifford

Wednesday 30 July 2008 8:21:03 am

Thanks for all of your help so far guys, but I'm still stuck. Badly. :(

Matt Gifford

Wednesday 30 July 2008 8:23:46 am

I've managed to draw the contentobject_id using the following:

{$node.object.data_map.headerimage.image.content.id}

can I get the url from that at all?

Matt Gifford

Wednesday 30 July 2008 9:15:11 am

Got it! After most of the day (aargh!) this works..:

{$node.object.data_map.headerimage.content.data_map.image.content[original].full_path}

Thanks to all for help and advice.

eZ debug

Timing: Jan 30 2025 21:16:52
Script start
Timing: Jan 30 2025 21:16:52
Module start 'content'
Timing: Jan 30 2025 21:16:52
Module end 'content'
Timing: Jan 30 2025 21:16:52
Script end

Main resources:

Total runtime0.3716 sec
Peak memory usage8,192.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0105 588.1719370.2734
Module start 'content' 0.01050.0274 958.44531,009.7188
Module end 'content' 0.03790.3336 1,968.16413,899.0391
Script end 0.3715  5,867.2031 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00471.2544200.0002
Check MTime0.00140.3811200.0001
Mysql Total
Database connection0.00100.271810.0010
Mysqli_queries0.252367.89031410.0018
Looping result0.00150.41411390.0000
Template Total0.333289.710.3332
Template load0.00090.238710.0009
Template processing0.332389.414810.3323
Override
Cache load0.00060.170310.0006
Sytem overhead
Fetch class attribute can translate value0.00210.565110.0021
XML
Image XML parsing0.00030.084810.0003
General
dbfile0.02105.6553200.0011
String conversion0.00000.002430.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
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.0002 secs