Change header background based on language

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hello,
I setup a new site in two languages.  EN and ES. I am trying to make the header background image change based on the current language.  

In style.css i have the following:
.header {background: url('images/bg_header.gif') no-repeat;}

I was thinking of doing something like this in style.css
.header-en {background: url('images/bg_header_en.gif') no-repeat;}
.header-es {background: url('images/bg_header_es.gif') no-repeat;}

and changing the <div class="header"> in Modules/Header.ascx based on the language selected.  Depending on the language i would have <div class="header-en"> or <div class="header-es">.  I don´t know if this is the right aproach and don´t know how to do this in Header.ascx.

Help would be apreciated. Thanks
13 years ago
[email protected] wrote:
Hello,
I setup a new site in two languages.  EN and ES. I am trying to make the header background image change based on the current language.  

In style.css i have the following:
.header {background: url('images/bg_header.gif') no-repeat;}

I was thinking of doing something like this in style.css
.header-en {background: url('images/bg_header_en.gif') no-repeat;}
.header-es {background: url('images/bg_header_es.gif') no-repeat;}

and changing the <div class="header"> in Modules/Header.ascx based on the language selected.  Depending on the language i would have <div class="header-en"> or <div class="header-es">.  I don´t know if this is the right aproach and don´t know how to do this in Header.ascx.

Help would be apreciated. Thanks


You can do something like this... in the header.ascx put this code where the div that will have the background is:

<% if (NopContext.Current.WorkingLanguage.Name == "Spanish")
    { %>
        <div class="espanol">
    <%}
    else
    { %>
        <div class="english">
<%}%>


If the language is Spanish, show the Spanish background, else... default to English. You can switch it around if you want Spanish to be the default. I know that English is "English", but not sure what Spanish is called... it may be whatever you name it, I'm not sure.

If you're using the language selector that is built into nopCommerce the page will reload when a choice is made and that should change the background....
13 years ago
Thank very much.
Just what i needed!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.