Forums / Setup & design / Change logo depending on section

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

eZ debug

Timing: Jan 18 2025 04:25:25
Script start
Timing: Jan 18 2025 04:25:25
Module start 'content'
Timing: Jan 18 2025 04:25:26
Module end 'content'
Timing: Jan 18 2025 04:25:26
Script end

Main resources:

Total runtime0.9190 sec
Peak memory usage4,096.0000 KB
Database Queries212

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0085 587.7344180.8281
Module start 'content' 0.00850.7482 768.5625709.4844
Module end 'content' 0.75670.1617 1,478.0469344.4609
Script end 0.9184  1,822.5078 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00430.4635210.0002
Check MTime0.00160.1703210.0001
Mysql Total
Database connection0.00160.173310.0016
Mysqli_queries0.817989.00202120.0039
Looping result0.00270.29712100.0000
Template Total0.878495.620.4392
Template load0.00230.251720.0012
Template processing0.876195.331320.4380
Template load and register function0.00030.037510.0003
states
state_id_array0.00240.255810.0024
state_identifier_array0.00080.091320.0004
Override
Cache load0.00200.2187430.0000
Sytem overhead
Fetch class attribute can translate value0.00210.224160.0003
Fetch class attribute name0.00140.1534100.0001
XML
Image XML parsing0.00260.281360.0004
class_abstraction
Instantiating content class attribute0.00000.0024120.0000
General
dbfile0.00320.3478390.0001
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 30
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs