johanndc Posted July 11, 2014 Share Posted July 11, 2014 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 More sharing options...
PSfever.com Posted July 11, 2014 Share Posted July 11, 2014 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 More sharing options...
vekia Posted July 11, 2014 Share Posted July 11, 2014 what prestashop version? (and theme) everything depends on these two things Link to comment Share on other sites More sharing options...
johanndc Posted July 11, 2014 Author Share Posted July 11, 2014 Hello and thanks for your quick reply, this is really cool. PSFever, I tried your method : I wasn't able to make it work but maybe I did something wrong. Vekia, my Prestashop version is 1.6.0.8 and I'm using the ZENSATION (non-responsive version) theme. Link to comment Share on other sites More sharing options...
vekia Posted July 11, 2014 Share Posted July 11, 2014 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 More sharing options...
johanndc Posted July 11, 2014 Author Share Posted July 11, 2014 (edited) 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 : 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 July 11, 2014 by johanndc (see edit history) Link to comment Share on other sites More sharing options...
johanndc Posted July 11, 2014 Author Share Posted July 11, 2014 (edited) 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 July 11, 2014 by johanndc (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted July 12, 2014 Share Posted July 12, 2014 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now