Page 1 of 1

[Solved] Latest news item not in the right language

Posted: Fri Nov 27, 2009 11:38 am
by sister
Hello,

I use two languages (english and dutch).
In the news articles I made two categories.

In the page I call the latest detail form one category like:
{news category="Cat-$lang" action="detail" articleid="-1" }

The problem is that it doen't seem to see the category.
It takes only the latest article in both languages.
How can I solve this?

Sister

Cms 1.6.3

Re: Latest news item not in the right language

Posted: Fri Nov 27, 2009 12:04 pm
by Peciura
"-" is not recommended in variables, because  smarty is to subtract variable $lang from string 'Cat'

{news category="Cat_$lang" action="detail" articleid="-1" } should work.
Or

Code: Select all

{capture assign='category_mle'}Cat-{$lang}{/capture}
{news category=$category_mle  action="detail" articleid="-1" } 

Re: Latest news item not in the right language

Posted: Fri Nov 27, 2009 1:01 pm
by sister
Well, it is partially working.

I changed the names of the categories in 'nl' and 'en'.

I changed also:
{news category=$lang_parent action='detail' articleid='-1' }

in:
{news action='detail' articleid='-1' category=$lang_parent }

I changed the order, that seems to do the trick.

But....
Now it is only showing one last article. The other language has nothing. How can I find the last article per language?

Sister

Re: Latest news item not in the right language

Posted: Fri Nov 27, 2009 5:07 pm
by Peciura
In this case don't use parameter articleid and action should be set to "summary".

1. In news help there are listed available parameters. One of them is "number".
2. Create new summary template that omits pagination though shows complete article. (Lets name it "latest_article_mle")
3. Don't forget to specify this summary template when calling "News" module.
News tag should look like:

Code: Select all

{news category=$lang_parent number=1 summarytemplate='latest_article_mle' lang=$lang}
If your language KEYS  are "nl_NL" and "en_US" than you have to create categories like "nl_NL_parent" and "en_US_parent" . Category is dynamically called by expression

Code: Select all

$lang_parent
.
There are some ways to see what are $lang values:
  a. place {$lang} anywhere in you page,
  b. look what are legends of fieldsets in "Site Admin » Global Settings » MLE languages"
  c. check what are key values of an array $hls in "/config_lang.php"

Re: Latest news item not in the right language

Posted: Sun Nov 29, 2009 12:18 pm
by sister
Wow, yes it is working. Thank you.