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.

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 31 2025 01:20:48
Script start
Timing: Jan 31 2025 01:20:48
Module start 'layout'
Timing: Jan 31 2025 01:20:48
Module start 'content'
Timing: Jan 31 2025 01:20:48
Module end 'content'
Timing: Jan 31 2025 01:20:48
Script end

Main resources:

Total runtime0.0271 sec
Peak memory usage6,144.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.3750151.2422
Module start 'layout' 0.00570.0038 739.6172220.7500
Module start 'content' 0.00950.0160 960.36721,005.9609
Module end 'content' 0.02550.0016 1,966.328141.9922
Script end 0.0271  2,008.3203 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002710.0262140.0002
Check MTime0.00113.9597140.0001
Mysql Total
Database connection0.00093.237810.0009
Mysqli_queries0.00217.845730.0007
Looping result0.00000.033410.0000
Template Total0.00124.310.0012
Template load0.00093.322210.0009
Template processing0.00030.965110.0003
Override
Cache load0.00062.224410.0006
General
dbfile0.003211.643880.0004
String conversion0.00000.024640.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