$lang within Smarty [SOLVED]

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
antosha
Forum Members
Forum Members
Posts: 60
Joined: Fri Jun 06, 2008 7:20 pm
Location: Montreal, Canada

$lang within Smarty [SOLVED]

Post by antosha »

Hello,

I'm currently working with CTLModuleMaker and I'm trying to make the module I created, work with MLE.

So on my website I have three languages English (en), French (fr), and Russian(ru)

With the module I have created with the modulemaker, i have the following tags  (Tour Description for every language)
$item->tourdescen  
$item->tourdescfr
$item->tourdescru


What I want to do is that depending on which site language the user is currently on, the correct description will show.
I tried this :

{$item->tourdesc$lang}

but it doesn't work, gives me a error.

Some help would be appreciated.
Thanks :)
Last edited by antosha on Sun Dec 20, 2009 5:52 am, edited 1 time in total.
Follow me on twitter: end_tone
Linked In: levchenkoanton
antosha
Forum Members
Forum Members
Posts: 60
Joined: Fri Jun 06, 2008 7:20 pm
Location: Montreal, Canada

Re: $lang within Smarty

Post by antosha »

I think I might have found something...

Code: Select all

{if $lang ==fr}{$item->tourdescfr}{else}
{if $lang ==ru}{$item->tourdescru}{else}
{if $lang ==en}{$item->tourdescen}{/if}{/if}{/if}
Now there is no more smarty error, but the text is still not showing.
Follow me on twitter: end_tone
Linked In: levchenkoanton
antosha
Forum Members
Forum Members
Posts: 60
Joined: Fri Jun 06, 2008 7:20 pm
Location: Montreal, Canada

Re: $lang within Smarty

Post by antosha »

I'm sorry,
After some time spent on testing I found that the problem comes from the module itself. For some reason, when I call the module in a page, everything comes off blank.

I'll try to find an answer in forums about plugins.

Thanks.
Follow me on twitter: end_tone
Linked In: levchenkoanton
antosha
Forum Members
Forum Members
Posts: 60
Joined: Fri Jun 06, 2008 7:20 pm
Location: Montreal, Canada

Re: $lang within Smarty

Post by antosha »

Ok this looks like I'm talking to myself, but I solved the problem.

After i did a content dump, I realized languages are not being printed as en,fr,ru but as en_US, fr_FR, ru_RU.  ::)

So I write this in my template :

Code: Select all

{if $lang =="en_US"}{$labels->guideddescen}{else}
{if $lang =="fr_FR"}{$labels->guideddescfr}{else}
{if $lang =="ru_RU"}{$labels->guideddescru}{/if}{/if}{/if}

Sorry for spamming your forums  :P
Last edited by antosha on Sun Dec 20, 2009 5:55 am, edited 1 time in total.
Follow me on twitter: end_tone
Linked In: levchenkoanton
Post Reply

Return to “Developers Discussion”