Loading...
 
 Error
  • Contact the site administrator. The index needs rebuilding.
Features / Usability

Features / Usability


Language variable for a condition in a Smarty Template

posts: 8633 Israel

Hello,

In a Smarty template I use with a plugin list, I need conditions depending on the language of the page.

Looking in the debug console of Tiki, I have a variable $frontendLang that equal the language abbreviation for the current page.

sprint $frontendLang
frontendLang = fr

In my Smarty template I set then:

{if $frontendLang eq 'fr'}En francais{/if}


But that the condition is not working (text is always displayed).
What am I missing ?


Note this is just a sample my code should be more like this in the end;
{CODE()}
{if $frontendLang eq 'fr'}

...french content

{elseif $frontendLang eq 'he'}

...hebrew content

{else}

...english content

{/if}

posts: 2428 Czech Republic
I think the correct variable is $lang or $language. Try to put {$frontendLang} before the if to debug.

posts: 8633 Israel

I thought so...

I call the template using:

Copy to clipboard
{LIST()} {output tplwiki="videoTutorials_tpl"} {LIST}


In the wiki page (the template) I have:
1: {$frontendLang}
2 : {$language}
3 : {$languages}
4 : {$lang}
All return an empty value.



If I use the Tiki debugger I have for the same variable:
$frontendLang = en
$language = not found
$languages = array of all languages in use
$lang = en

May be something related to the way I’m including the template in the page ?