留言板
Problem accessing structure field when localized
Fernando Fernandez,修改在7 年前。
Problem accessing structure field when localized
Expert 帖子: 396 加入日期: 07-8-22 最近的帖子
Hi guys,
I'm creating a template for a custom structure with localizable fields mixed with non-localizable fields. This in 6.2 CE with Velocity.
To simplify, let's say my structure has two fields: name (text), localizable and picture (a d&m link), non-localizable.
Now, the user has created a web content with this structure with a base locale of pt_PT and a translation for en_US. The user has input name in the two languages but the web content editor only asked for the default locale picture - and that's the expected behaviour.
The problem is that in the template I'm accessing the picture url with
but this only works when the user has the default language selected (pt_PT). As soon as the user switches to en_US, the method result becomes empty.
Since getData() does not have a $locale parameter, I wonder how can I get the correct value in the template.
Any ideas?
Thanks in advance
Fernando
I'm creating a template for a custom structure with localizable fields mixed with non-localizable fields. This in 6.2 CE with Velocity.
To simplify, let's say my structure has two fields: name (text), localizable and picture (a d&m link), non-localizable.
Now, the user has created a web content with this structure with a base locale of pt_PT and a translation for en_US. The user has input name in the two languages but the web content editor only asked for the default locale picture - and that's the expected behaviour.
The problem is that in the template I'm accessing the picture url with
$Picture.getData()
but this only works when the user has the default language selected (pt_PT). As soon as the user switches to en_US, the method result becomes empty.
Since getData() does not have a $locale parameter, I wonder how can I get the correct value in the template.
Any ideas?
Thanks in advance
Fernando
Fernando Fernandez,修改在7 年前。
RE: Problem accessing structure field when localized
Expert 帖子: 396 加入日期: 07-8-22 最近的帖子
The stranger thing with this issue is that the problem exists only when the template is being used in an asset publisher on a display page.
If I put a web content display with this particular content/template the getData() method returns the correct localized content in any language...
Fernando
If I put a web content display with this particular content/template the getData() method returns the correct localized content in any language...
Fernando
Fernando Fernandez,修改在7 年前。
RE: Problem accessing structure field when localized
Expert 帖子: 396 加入日期: 07-8-22 最近的帖子
I must correct myself.
The getData() in the template works well for all locales if called by a WCD in a page with nothing else.
But If I add another simple WCD with a dummy text the getData() stops working for all but the default locale. I mean, the getData for non-localizable fields. For the localizable fields it works OK.
The problem exists both in Velocity and Freemarker templates.
Fernando
The getData() in the template works well for all locales if called by a WCD in a page with nothing else.
But If I add another simple WCD with a dummy text the getData() stops working for all but the default locale. I mean, the getData for non-localizable fields. For the localizable fields it works OK.
The problem exists both in Velocity and Freemarker templates.
Fernando
Fernando Fernandez,修改在7 年前。