掲示板

Get site id or name in theme

11年前 に Peter Hellstrand によって更新されました。

Get site id or name in theme

Regular Member 投稿: 166 参加年月日: 11/11/30 最新の投稿
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
11年前 に Harish Kumar によって更新されました。

RE: Get site id or name in theme

Expert 投稿: 483 参加年月日: 10/07/31 最新の投稿
Hi Peter,

site id is nothing but the group id in Liferay.

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


Regards
thumbnail
10年前 に Avinash R によって更新されました。

RE: Get site id or name in theme

New Member 投稿: 13 参加年月日: 13/09/19 最新の投稿
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
11年前 に Jignesh Vachhani によって更新されました。

RE: Get site id or name in theme

Liferay Master 投稿: 803 参加年月日: 08/03/10 最新の投稿
You can use $theme_display.getScopeGroupId() in your theme
11年前 に Peter Hellstrand によって更新されました。

RE: Get site id or name in theme

Regular Member 投稿: 166 参加年月日: 11/11/30 最新の投稿
Thank you both
10年前 に Nahuel Barrios によって更新されました。

RE: Get site id or name in theme

New Member 投稿: 1 参加年月日: 13/08/08 最新の投稿
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!