Foros de discusión

Get site id or name in theme

Peter Hellstrand, modificado hace 11 años.

Get site id or name in theme

Regular Member Mensajes: 166 Fecha de incorporación: 30/11/11 Mensajes recientes
Hello

Is it possible to get the site id or name in theme.


If($site.getId == "the_site"){
    <a href="site url">link on visible on my site</a>
}

thumbnail
Harish Kumar, modificado hace 11 años.

RE: Get site id or name in theme

Expert Mensajes: 483 Fecha de incorporación: 31/07/10 Mensajes recientes
Hi Peter,

site id is nothing but the group id in Liferay.

long id = themeDisplay.getLayout().getGroupId();


Regards
thumbnail
Avinash R, modificado hace 10 años.

RE: Get site id or name in theme

New Member Mensajes: 13 Fecha de incorporación: 19/09/13 Mensajes recientes
how can i get the same in the custom portlet implementation?

EDIT: found it out

in portlet implementations use:

PortalUtil.getScopeGroupId(request);


to get the site id. Although this means that the staging and live sites will have different set of data.
thumbnail
Jignesh Vachhani, modificado hace 11 años.

RE: Get site id or name in theme

Liferay Master Mensajes: 803 Fecha de incorporación: 10/03/08 Mensajes recientes
You can use $theme_display.getScopeGroupId() in your theme
Peter Hellstrand, modificado hace 11 años.

RE: Get site id or name in theme

Regular Member Mensajes: 166 Fecha de incorporación: 30/11/11 Mensajes recientes
Thank you both
Nahuel Barrios, modificado hace 10 años.

RE: Get site id or name in theme

New Member Mensaje: 1 Fecha de incorporación: 8/08/13 Mensajes recientes
Hi, in our team we get it working (get the site name) by using:

[indent]#set($groupLocalService= $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
<h1>$groupLocalService.getGroup($groupId).getName()</h1>[/indent]


Greetins!