Jump to content

Append language ID as a div class or ID


Recommended Posts

In order to customize my product page individually, I used the unique product reference ast a body class

<div class="{$product->reference|escape:'htmlall':'UTF-8'}">

 

 

How can I do something similar with the language ID, however I would like to do an if Statement like the following:

 

{if $lang_iso == 1 }Foo in English{else} Foo In Spanish{/if}

 

The above code isn't working for me.

 

Can someone help me with the syntax for identifying a specific language?

 

This {if $lang_iso == 1 } seems to be wrong.

Edited by ddmbrands (see edit history)
Link to comment
Share on other sites

Hi There,

$lang_iso would be "en", since ISO is the actual language iso code, not the language id. Using the ID would be a bit complex.

For that, you should create a foreach loop like "foreach from=$languages" and if the lang_iso variable matches the current iso, assign the language id to a new variable, so that you can further test it.

 

of course, using only language isos would be easier :)

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...