留言板

Get articles with language_id parameter - SOLVED

thumbnail
Filippo Boatto,修改在14 年前。

Get articles with language_id parameter - SOLVED

Regular Member 帖子: 107 加入日期: 07-2-1 最近的帖子
with this code a have the last article o type "products"

http://@portal_url@/c/journal/get_articles?groupId=@group_id@&type=products&delta=1&approved=true&expired=false&[b]language_id=@language_id@[/b]&orderBy=display-date


but the language_id=@language_id@ seems to be ignored...why?

P.S. the article uses a structure and a template. It is inserted with localized check box checked.
thumbnail
Amos Fong,修改在14 年前。

RE: Get articles with language_id parameter

Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
Hi Filippo,

That doesn't appear to be a valid token. See the full list in journalUtil.java. Try using $locale instead.

If you haven't already found it, this is a good list of velocity variables available to you:

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/How%20To%20Access%20Objects%20From%20A%20Velocity%20Template
thumbnail
Filippo Boatto,修改在14 年前。

RE: Get articles with language_id parameter

Regular Member 帖子: 107 加入日期: 07-2-1 最近的帖子
The problem is not the @language_id@ because it contains the same value of $locale.

te problem is that the get_articles doen't matter the language_id parameter:

http://10.1.4.191:8082/portal/c/journal/get_articles?groupId=12501&[b]language_id=en_US[/b]&type=marketing&delta=1&approved=true&expired=false&orderBy=display-date

and

http://10.1.4.191:8082/portal/c/journal/get_articles?groupId=12501&[b]language_id=it_IT[/b]&type=marketing&delta=1&approved=true&expired=false&orderBy=display-date

does not returns the same article in English or Italian but returns always the same article in the same language.

I've tried this in the portlet WebContent dysplay in my portal and it does not work, with or without language_id parameter.
BUT if i try the link, without the language parameter, in another window,

http://10.1.4.191:8082/portal/c/journal/get_articles?groupId=12501&type=marketing&delta=1&approved=true&expired=false&orderBy=display-date

it returns the right article with the current language selected in the portal.
thumbnail
Filippo Boatto,修改在14 年前。

RE: Get articles with language_id parameter

Regular Member 帖子: 107 加入日期: 07-2-1 最近的帖子
the parameter to use is:

&[b][color=#00C002]languageId[/color][/b]=@language_id@


and NOT:

&[b][color=#C00300]language_id[/color][/b]=@language_id@



I use this URL

http://@portal_url@/c/journal/get_articles?groupId=@group_id@&[b]languageId=@language_id@[/b]&type=marketing&approved=true&expired=false&delta=1&orderBy=display-date



look at Wiki
thumbnail
Amos Fong,修改在14 年前。

RE: Get articles with language_id parameter

Liferay Legend 帖子: 2047 加入日期: 08-10-7 最近的帖子
oh interesting, I didn't know that. Anyways nice job!
thumbnail
Francesco Marangi,修改在14 年前。

RE: Get articles with language_id parameter

New Member 帖子: 9 加入日期: 09-2-6 最近的帖子
Hi guys,

I wanted to have access to the current locale inside a text area of a journal article .

Other tokens, like @root_path@ and @main_path@, work as expected, but somehow @language_id@ is not parsed and is returned as is. What's wrong with that? Should i set up something in the .properties files? I'm not talking about Velocity Templates, i want to access these tokens from a web content directly.

Can anybody help me with that? Thanks a million!

Francesco
Alex Galkin,修改在11 年前。

RE: Get articles with language_id parameter

New Member 帖子: 9 加入日期: 12-11-29 最近的帖子
Same happens for me. @language_id@ is not parsed in Web Content. Please post any suggestion or workaround. Thanks