Forums de discussion

Site custom field

Juraj Krahulec, modifié il y a 9 années.

Site custom field

New Member Publications: 4 Date d'inscription: 20/05/14 Publications récentes
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, modifié il y a 9 années.

RE: Site custom field

Liferay Master Publications: 722 Date d'inscription: 05/08/10 Publications récentes
can you provide proper code here ?

Is site here, object of Group?
Juraj Krahulec, modifié il y a 9 années.

RE: Site custom field

New Member Publications: 4 Date d'inscription: 20/05/14 Publications récentes
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, modifié il y a 8 années.

RE: Site custom field

Regular Member Publications: 208 Date d'inscription: 28/01/08 Publications récentes
Were you able to get this to work? I am trying it on 6.2, but it does not work.
Mark Fitzgerald, modifié il y a 8 années.

RE: Site custom field

Regular Member Publications: 108 Date d'inscription: 15/10/10 Publications récentes
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, modifié il y a 8 années.

RE: Site custom field

Regular Member Publications: 166 Date d'inscription: 23/07/12 Publications récentes
Hi,
Try this $layout.getGroup().getExpandoBridge().getAttribute("attirbute-key"); . A list of access objects from velocity is sited here

Arun
Stan X, modifié il y a 8 années.

RE: Site custom field

Regular Member Publications: 208 Date d'inscription: 28/01/08 Publications récentes
Thanks for the responses.

The following worked for me:

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