Forums / Setup & design / Banner/Billboard placement in pagelayout.tpl

Banner/Billboard placement in pagelayout.tpl

Author Message

Steve Pina

Monday 03 November 2008 8:56:11 am

Ok, so I'm really struggling with something. That is banners/billboards. I'm running version 4. I need a different banner for every page. The main difference in what I want than what is in the pre-built packages is my banner needs to be above the navigation. I know where to place the code in my pagelayout.tpl but my problem is the what code to use.

In the admin interface I have Media library - Banners. There I have my banner jpg graphic uploaded and it is node ID 160.

In a previous post and in the docs it mentions the following code:

{def $my_node=fetch( content, node, hash( node_id, 160 ) )}

Which outputs on the site this: Object(eZContentObjectTreeNode)

From my understanding of the docs, the above code returns an array, but what to do with this array I have no idea, or maybe I shouldn't be using this code at all?? Then there is the extension\ezwebin\design\ezwebin\override\templates\billboard\banner.tpl???

I'm confused, I would appreciate anyone's help!!! Thanks!

Greg McAvoy-Jensen

Monday 03 November 2008 9:13:48 am

You might try:
content_view_gui view=billboard content_object=$my_node.data_map.billboard.content}

The last word, "billboard" should correspond to the name of the attribute for the actual 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

Steve Pina

Monday 03 November 2008 10:34:50 am

Thanks for the reply Greg.

So I placed your code in and nothing displays. I have the following:

{def $my_node=fetch( content, node, hash( node_id, 160 ) )}
{content_view_gui view=billboard content_object=$my_node.data_map.Home-Banner.content}

Home Banner is the name of my graphic so I put Home-Banner. Does any of this need to be contained in <img tag?

Thanks!

Greg McAvoy-Jensen

Monday 03 November 2008 11:43:08 am

Actually, it sounds like the node you've called is the actual banner itself, so you'll probably want:

{attribute_view_gui attribute=$my_node.object.data_map.X image_class=billboard}

To find out what to enter for X, plunk in this code:
{$my_node.object.data_map|attribute(show,1)}
This will reveal the listing of the names of the fields ("attributes") for whatever your banner class is. Pick the one that has the actual image in it.

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

Steve Pina

Tuesday 04 November 2008 12:57:40 pm

So if put in the following:

{def $my_node=fetch( content, node, hash( node_id, 43 ) )}
{$my_node.object.data_map|attribute(show,1)}

{def $my_node1=fetch( content, node, hash( node_id, 59 ) )}
{$my_node1.object.data_map|attribute(show,1)}

{def $my_node2=fetch( content, node, hash( node_id, 160 ) )}
{$my_node2.object.data_map|attribute(show,1)}

43 = Media (which is Media Library)
59 = Banners (under media)
160 = HomeBanner (under Banners, the image I want to display)

They all display the same stuff (the Attributes change but the Type and Value don't):
Attribute Type Value
name object[eZContentObjectAttribute] Object

This code:
{$my_node2.name|wash}
Will display: HomeBanner

All I want to do display an image that is in Media -- Banners. It can be this hard can it? Thanks!