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.

eZ debug

Timing: Jan 18 2025 10:37:52
Script start
Timing: Jan 18 2025 10:37:52
Module start 'layout'
Timing: Jan 18 2025 10:37:52
Module start 'content'
Timing: Jan 18 2025 10:37:53
Module end 'content'
Timing: Jan 18 2025 10:37:53
Script end

Main resources:

Total runtime1.0250 sec
Peak memory usage4,096.0000 KB
Database Queries75

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0069 587.9375152.6250
Module start 'layout' 0.00700.0029 740.562539.4453
Module start 'content' 0.00981.0136 780.0078706.3438
Module end 'content' 1.02340.0015 1,486.351620.1563
Script end 1.0249  1,506.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3593160.0002
Check MTime0.00140.1342160.0001
Mysql Total
Database connection0.00110.108010.0011
Mysqli_queries0.947592.4421750.0126
Looping result0.00080.0819730.0000
Template Total0.989096.520.4945
Template load0.00290.278720.0014
Template processing0.986196.205120.4930
Template load and register function0.00020.022210.0002
states
state_id_array0.00160.153610.0016
state_identifier_array0.00150.148420.0008
Override
Cache load0.00250.2426430.0001
Sytem overhead
Fetch class attribute can translate value0.00090.089650.0002
Fetch class attribute name0.00190.1814100.0002
XML
Image XML parsing0.00550.538450.0011
class_abstraction
Instantiating content class attribute0.00000.0019120.0000
General
dbfile0.00450.4365280.0002
String conversion0.00000.000940.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
7content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 30
 Number of unique templates used: 6

Time used to render debug report: 0.0003 secs