Jump to content

[SOLVED] language global.css


Recommended Posts

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 by Frens (see edit history)
Link to comment
Share on other sites

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

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

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

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

×
×
  • Create New...