Fórum

Site custom field

Juraj Krahulec, modificado 9 Anos atrás.

Site custom field

New Member Postagens: 4 Data de Entrada: 20/05/14 Postagens Recentes
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, modificado 9 Anos atrás.

RE: Site custom field

Liferay Master Postagens: 722 Data de Entrada: 05/08/10 Postagens Recentes
can you provide proper code here ?

Is site here, object of Group?
Juraj Krahulec, modificado 9 Anos atrás.

RE: Site custom field

New Member Postagens: 4 Data de Entrada: 20/05/14 Postagens Recentes
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, modificado 8 Anos atrás.

RE: Site custom field

Regular Member Postagens: 208 Data de Entrada: 28/01/08 Postagens Recentes
Were you able to get this to work? I am trying it on 6.2, but it does not work.
Mark Fitzgerald, modificado 8 Anos atrás.

RE: Site custom field

Regular Member Postagens: 108 Data de Entrada: 15/10/10 Postagens Recentes
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, modificado 8 Anos atrás.

RE: Site custom field

Regular Member Postagens: 166 Data de Entrada: 23/07/12 Postagens Recentes
Hi,
Try this $layout.getGroup().getExpandoBridge().getAttribute("attirbute-key"); . A list of access objects from velocity is sited here

Arun
Stan X, modificado 8 Anos atrás.

RE: Site custom field

Regular Member Postagens: 208 Data de Entrada: 28/01/08 Postagens Recentes
Thanks for the responses.

The following worked for me:

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