Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Get site id or name in theme
Hello
Is it possible to get the site id or name in theme.
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>
}
Hi Peter,
site id is nothing but the group id in Liferay.
Regards
site id is nothing but the group id in Liferay.
long id = themeDisplay.getLayout().getGroupId();Regards
how can i get the same in the custom portlet implementation?
EDIT: found it out
in portlet implementations use:
to get the site id. Although this means that the staging and live sites will have different set of data.
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.
You can use $theme_display.getScopeGroupId() in your theme
Thank you both
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!
[indent]#set($groupLocalService= $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
<h1>$groupLocalService.getGroup($groupId).getName()</h1>[/indent]
Greetins!