This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » Setup & design » how to get data from object within...
expandshrink

how to get data from object within pagelayout template?

how to get data from object within pagelayout template?

Saturday 26 July 2008 5:49:47 pm - 9 replies

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

Saturday 26 July 2008 6:08:02 pm

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.

Saturday 26 July 2008 6:15:23 pm

Greg, thank you so much. You are a legend. happy.gif Emoticon

Wednesday 30 July 2008 1:46:38 pm

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

Wednesday 30 July 2008 3:25:19 pm

Hi,

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

Wednesday 30 July 2008 4:24:16 pm

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

Modified on Wednesday 30 July 2008 4:24:42 pm by Matt Gifford

Wednesday 30 July 2008 4:36:56 pm

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).

Wednesday 30 July 2008 5:21:03 pm

Thanks for all of your help so far guys, but I'm still stuck. Badly. sad.gif Emoticon

Wednesday 30 July 2008 5:23:46 pm

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?

Wednesday 30 July 2008 6:15:11 pm

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.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from