Page 1 of 1

[SOLVED] Babel and news article

Posted: Mon Dec 12, 2011 5:13 pm
by Mich-adg
Hi all,

i'm looking for a way to display a news article category depending of the lang of the current page. I use Babel for my site.

I tried this at the top of my template :

Code: Select all

{babel action="assign"}
{capture assign=actualang}
{babel show="lang_article"} //babel ml entry
{/capture}
and to display the news but i doesn't work :

Code: Select all

{news number='3' category='$actualang | news'  moretext='...'}
Any idea ?
Thx.

Re: Babel and news article

Posted: Fri Jan 13, 2012 7:25 pm
by mmarius
You need to use backticks inside quotes:

Code: Select all

{news number='3' category="`$actualang` | news"  moretext='...'}

Re: Babel and news article

Posted: Wed Jan 18, 2012 4:29 pm
by Mich-adg
Tanks for you reply, but this doesn't work for me actually.

But i displayed my $actualang simply in the page, and i discovered that the lang has an empty space after it (ie : fr ) and perhaps that's the problem. Any idea to delete empty character after a string variable in smarty ?

[SOLVED ]Babel and news article

Posted: Wed Jan 18, 2012 4:50 pm
by Mich-adg
I tried a different variable and yet it works! Thanks for the backticks tip! The double quotes are important too.

I make this now :

Code: Select all

{news number='1' detailpage='news' category="`$page_lang` | mycat | news" summarytemplate='template' moretext='More...'}
$page_lang is generated by Babel, so i named my first categories "en_EN, fr_FR...". Now i have to change the moretext with a variable string and i got it ;)