[Solved] Latest news item not in the right language

This is a FORK of the CMS Made Simple project and is not oficially supported in any way by the CMS Made Simple development team.
Locked
sister
Forum Members
Forum Members
Posts: 57
Joined: Mon Dec 22, 2008 2:23 pm

[Solved] Latest news item not in the right language

Post 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
Last edited by sister on Sun Nov 29, 2009 12:18 pm, edited 1 time in total.
Peciura

Re: Latest news item not in the right language

Post 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" } 
sister
Forum Members
Forum Members
Posts: 57
Joined: Mon Dec 22, 2008 2:23 pm

Re: Latest news item not in the right language

Post 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
Peciura

Re: Latest news item not in the right language

Post 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"
Last edited by Peciura on Thu Dec 10, 2009 5:51 pm, edited 1 time in total.
sister
Forum Members
Forum Members
Posts: 57
Joined: Mon Dec 22, 2008 2:23 pm

Re: Latest news item not in the right language

Post by sister »

Wow, yes it is working. Thank you.
Locked

Return to “[locked] CMSMS MLE fork”