留言板

Site custom field

Juraj Krahulec,修改在9 年前。

Site custom field

New Member 帖子: 4 加入日期: 14-5-20 最近的帖子
Hi all,

in Liferay 6.1 I set custom field defined for Site. I want get this value in theme. I found this code to get the value:

site.getExpandoBridge().getAttribute("attirbute-key")

But this code do not work for me.

Thanks for any help.
thumbnail
Pankaj Kathiriya,修改在9 年前。

RE: Site custom field

Liferay Master 帖子: 722 加入日期: 10-8-5 最近的帖子
can you provide proper code here ?

Is site here, object of Group?
Juraj Krahulec,修改在9 年前。

RE: Site custom field

New Member 帖子: 4 加入日期: 14-5-20 最近的帖子
Thank you for your reply.

Yes, site is object of Group.

I have one Portal and 8 Sites. Each site have set up custom field - version. And this value I need get to the theme(portal-normal.vm).
Stan X,修改在8 年前。

RE: Site custom field

Regular Member 帖子: 208 加入日期: 08-1-28 最近的帖子
Were you able to get this to work? I am trying it on 6.2, but it does not work.
Mark Fitzgerald,修改在8 年前。

RE: Site custom field

Regular Member 帖子: 108 加入日期: 10-10-15 最近的帖子
Stan,

Can you post your code here? I'm using this in my portal_normal.vm template and it's working fine.

#set ($attributeValues = $group.getExpandoBridge().getAttribute("<attribute-to-get>"))
#if ($attributeValues.get(0) == "<value-to-compare>")
## Do task here
#end</value-to-compare></attribute-to-get>
thumbnail
Arun Das,修改在8 年前。

RE: Site custom field

Regular Member 帖子: 166 加入日期: 12-7-23 最近的帖子
Hi,
Try this $layout.getGroup().getExpandoBridge().getAttribute("attirbute-key"); . A list of access objects from velocity is sited here

Arun
Stan X,修改在8 年前。

RE: Site custom field

Regular Member 帖子: 208 加入日期: 08-1-28 最近的帖子
Thanks for the responses.

The following worked for me:

#set ($cfield = $layout.getGroup().getExpandoBridge().getAttribute("customfield"))