Choosing theme images based on lang

benoitch

Joined: 2005-11-10
Posts: 2
Posted: Wed, 2006-08-09 20:44

I'm trying to display a menu made of buttons (images) that are localized. Hence I need to choose the right button images as well as the link they point to. The way I do this is by selecting a different html file from the sidebar.tpl file. However, the problem I have is exactly the selection.

I have used the following to get the language:

Quote:
{php}
global $gallery;
list ($ret, $languageCode) = $gallery->getActiveLanguageCode();
{/php}

Now, I don't know how to pass the language to smarty so I can call {g->theme include=$mylangMenu}. I know I must use $smarty_var->assign(). But I cannot find the actual smarty variable. Is there one available from within the templates ?

If not, is there any other way to besides hard-coding the menu file path in the template ?

Thanks

 
maichele

Joined: 2008-01-22
Posts: 2
Posted: Mon, 2008-02-11 13:30

Hi,

you need to assign the php variable to a smarty variable, just add the this line:

{php}
  global $gallery;
  list ($ret, $languageCode) = $gallery->getActiveLanguageCode();
  $this->assign('mylanguage', $languageCode);
{/php}

Now you can access the language in smarty e.g.

{if $mylanguage == "de_DE"}
   ...
{else}
   ...
{/if}