Jump to content

How to display a different logo for some CMS pages?


Recommended Posts

Hello there,

As the title says, I'm just trying to bring up a different logo in my header according to the ID of the CMS pages. Note that I've managed to give a class to each of these pages, some of you will surely advise me to use the CSS background-image but my logo is displayed with IMG SRC.

Maybe a Smarty code?

Thank you in advance!

Johann

Link to comment
Share on other sites

Hi,

 

you have two options

1) Either set up logo in the .css file and then you can change the background image using CSS

2) Open your header.tpl file and place in those conditions along the src of your logo.

 

{if $body_classes == "cms-2" || "cms-1" }

....src is different..

{else}

....src is normal..

{/if}

Link to comment
Share on other sites

unfortunately this theme doesnt use unqiue id / class for <body> element for your cms pages.

in this case it's necessary to modify it

 

header.tpl file 

 

o body class="" element add

 

{if isset($smarty.get.id_cms)} cms_{$smarty.get.id_cms}{/if}

 

 

then your cms pages will have unique class  like

cms_1

cms_2

cms_3

 

etc.

 

it mean, that depending on this class you will be able to change src="" of <img> with logo

Link to comment
Share on other sites

Vekia you're right but I already tweaked header.tpl in order to add classes to CMS and as you can see below, the class is appearing near the body :

 

1405086620-cms.jpg

 

Despite that, the code kindly given by PSFever doesn't work or maybe I made a mistake somewhere. Below is the logo code that I found in blocktopmenu.tpl (not on header.tpl). What do you think about it? Where do I have to paste the php code please?

 

 <div class="header-logo"> <img class="logo" src="{$logo_url}" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if}/> </div>
Edited by johanndc (see edit history)
Link to comment
Share on other sites

Below is the custom code I entered in blocktopmenu.tpl but the red logo appears on every page. Looks like it's ignoring the {if} command...

<div class="header-logo"> <img class="logo" src="/img/logo-adm-red.png" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if} {if $body_classes == "cms7" || "cms9" }src="/img/logo-adm-black.png"{/if}/> </div>
Edited by johanndc (see edit history)
Link to comment
Share on other sites

i see what you expect now :)

 

okay, so simple you can use code like:

{if isset($smarty.get.id_cms)}
  {if $smarty.get.id_cms==5}
    LOGO 1
  {elseif $smarty.get.id_cms==12}
    LOGO 2
  {else}
    <div class="header-logo"> <img class="logo" src="/img/logo-adm-red.png" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if} {if $body_classes == "cms7" || "cms9" }src="/img/logo-adm-black.png"{/if}/> </div>
  {/if}
{else}
  <div class="header-logo"> <img class="logo" src="/img/logo-adm-red.png" alt="{$shop_name|escape:'htmlall':'UTF-8'}" {if $logo_image_width}width="{$logo_image_width}"{/if} {if $logo_image_height}height="{$logo_image_height}" {/if} {if $body_classes == "cms7" || "cms9" }src="/img/logo-adm-black.png"{/if}/> </div>
{/if}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...