Change logo depending on section

Author Message

Kristoffer Karlsson

Wednesday 30 May 2007 1:37:13 pm

Hi!

I'm trying to change the logo in the top of my page depending on which section the subtree belongs to. Does anyone have a suggestion on how to do this, or maybe a code sample?

I have a protected area (section) on my site and I want to show a different logo in the top of the page.

I'm using the standard ezpublish design ezwebin_site and version 3.9.1.

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

Niko Goers

Wednesday 30 May 2007 2:47:32 pm

Hi,

Pagelayout: {$module_result.section_id}

Node: {$node.section_id}

Depending on this variables you should be able to difference between your sections.

Greets

eZ Publish partner - http://www.all2e.com
http://share.ez.no/directory/companies/all2e-gmbh
http://ez.no/Partners/all2e-GmbH

Lords of Heaven - http://www.LoH-Gilde.de (Created with eZ Publish)
German online gaming guild

About me - http://www.NikoGoers.de

My roadmap, +1 are welcome: http://share.ez.no/community/roadmap/10889

Kristoffer Karlsson

Wednesday 30 May 2007 3:28:02 pm

Thanks for your answer.

Actually I'm quite new to ezPublish and I need you (or someone else) to explain a little bit more on how to do this.

I can not get it working based on the information in the last post.

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

paul bolger

Wednesday 30 May 2007 4:12:26 pm

Hi Kristoffer

I have banners which are determined by both the subtree folder and a selection switch in the content items, so you can select one of three banners for each section.

The actual banners are inserted by adding a stylesheet in the head of the document. You'll need to add a template include in the head of your pagelayout.

First, make the $node variable work again, new in eZpublish 3.9!

{if and( is_set($module_result.node_id), is_unset($node) )}
{def $node = fetch( content, node, hash( node_id, $module_result.node_id ) )}
{/if}

Second, build the first half of the stylesheet link (replace the strings with your own folder names):

<link rel="stylesheet" type="text/css" href="/design/news_site/stylesheets/banners/
{if $requested_uri_string|begins_with( 'about' )}
about-
{elseif $requested_uri_string|begins_with( 'your_council' )}
your-council-
{elseif $requested_uri_string|begins_with( 'community' )}
community-
{elseif $requested_uri_string|begins_with( 'library' )}
library-
{elseif $requested_uri_string|begins_with( 'tourism' )}
tourism-
{elseif $requested_uri_string|begins_with( 'contact' )}
contact-
{elseif $requested_uri_string|begins_with( 'search' )}
search-
{elseif $requested_uri_string|begins_with( 'help' )}
help-
{else}
{/if}

Third, test for the value of the user selection:

{if eq($node.data_map.banner_selection.data_text,'0')}
banner-1
{elseif eq($node.data_map.banner_selection.data_text,'1')}
banner-2
{elseif eq($node.data_map.banner_selection.data_text,'2')}
banner-3
{else}
banner
{/if}

Finally, finish off the css link.

.css"  />

If you replace the <>'s in the tag while you are messing around you'll be able to see the result in your browser.

Paul Bolger

Martin Ulrich

Wednesday 30 May 2007 4:36:53 pm

ich hab in my_pagelayout.tpl :

<div id="logo">{switch match=$module_result.section_id}
    {case match=6}
{def $my_node=fetch( 'content', 'node', hash( 'node_id', 72 ) )}
{attribute_view_gui attribute=$my_node.object.data_map.image align=center image_class=original href=$my_node.url_alias|ezurl()}
   {/case}
   {case match=7}
{def $my_node=fetch( 'content', 'node', hash( 'node_id', 262 ) )}
{attribute_view_gui attribute=$my_node.object.data_map.image align=center image_class=original href=$my_node.url_alias|ezurl()}
   {/case}
   {case match=8}
{def $my_node=fetch( 'content', 'node', hash( 'node_id', 99 ) )}
{attribute_view_gui attribute=$my_node.object.data_map.image align=center image_class=original href=$my_node.url_alias|ezurl()}
   {/case}
{case}
{def $my_node=fetch( 'content', 'node', hash( 'node_id', 42 ) )}
{attribute_view_gui attribute=$my_node.object.data_map.image align=center image_class=original href=$my_node.url_alias|ezurl()}
{/case}
 {/switch}
</div>

_______________________

http://artenic.de ARTENIC - Publishing mit allen Mitteln!

Kristoffer Karlsson

Thursday 31 May 2007 12:47:51 am

Perfect!

Thanks a lot.

_____________________________________
Blog: http://www.kristofferkarlsson.com
Website: http://www.spelkanalen.com

Alex Crowly

Sunday 18 January 2009 7:41:36 am

--spam--

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.