Frens Posted August 2, 2012 Share Posted August 2, 2012 (edited) I need to change the background image defined in global.css for my store header depending on the language selected by the user. Therefore I make a global_en , global_nl ... then in the classes/FrontController.php change Tools::addCSS(_THEME_CSS_DIR_.'global.css', 'all'); into; Tools::addCSS(_THEME_CSS_DIR_.'global_'.Tools::getValue('isolang').'.css', 'all'); It works fine, only if i use a module such as if I send to a friend , and a payment module using the global.css is not found and so there is no style on the page. someone a solution? ver 1.4.7.3 Edited August 10, 2012 by Frens (see edit history) Link to comment Share on other sites More sharing options...
shacker Posted August 8, 2012 Share Posted August 8, 2012 you can add in the header.tpl something like this {if $cookie->id_lang eq "1"} {literal} <style type="text/css"> body{background:url(../img/image.jpb)} </script> {/literal} Link to comment Share on other sites More sharing options...
Frens Posted August 9, 2012 Author Share Posted August 9, 2012 Hello Shacker, Thanks for comment I try something like ; <?php //NL if ($cookie->id_lang == 14) { include "aaa.css"; } // DE elseif($cookie->id_lang == 4) { include "bbb.css"; } ?> but I'm doing something wrong .. Link to comment Share on other sites More sharing options...
razaro Posted August 9, 2012 Share Posted August 9, 2012 Wouldn't be easier to use similar code like for on sale image <img src="{$img_dir}onsale_{$lang_iso}.gif" alt="{l s='On sale'}" class="on_sale_img"/> For example in tpl file where is background image container is you can have <div class="img_{$lang_iso}"> .. </div> and then in global.css .img_en { background: url('../img/en_background.gif'); } .img_fr { background: url('../img/fr_background.gif'); } .img_es { background: url('../img/es_background.gif'); } Link to comment Share on other sites More sharing options...
shacker Posted August 9, 2012 Share Posted August 9, 2012 is for the body, so cant add this tag somethig like this in header.tpl you need to put like the example, not with php tag, is in the header.tpl of the theme or category.tpl {if $cookie->id_lang eq "1"} {literal} <style type="text/css"> body{background:url(../img/image.jpb)} </script> {/literal} Link to comment Share on other sites More sharing options...
razaro Posted August 10, 2012 Share Posted August 10, 2012 It make no difference, can be used on body tag as well. In header.tpl <body {if $page_name eq '404'}id="pagenotfound"{elseif $page_name}id="{$page_name|escape:'htmlall':'UTF-8'}"{/if} class="back_{$lang_iso}"> and in global.css something like body.back_en { background: url('../img/en_background.jpg');} body.back_nl { background: url('../img/nl_background.jpg');} body.back_de { background: url('../img/de_background.jpg');} Link to comment Share on other sites More sharing options...
Frens Posted August 10, 2012 Author Share Posted August 10, 2012 Hello Thank you both for comment thy solved my problem ! Link to comment Share on other sites More sharing options...
shacker Posted August 11, 2012 Share Posted August 11, 2012 perfect. we are here to help Link to comment Share on other sites More sharing options...
Recommended Posts