掲示板

in velocity navigation.vm from another site

thumbnail
8年前 に Jack Bakker によって更新されました。

in velocity navigation.vm from another site

Liferay Master 投稿: 978 参加年月日: 10/01/03 最新の投稿
in theme with velocity, below returns group if logged in, but not as guest... how can I get group as guest ?

#set ($layoutLS = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set ($groupService = $serviceLocator.findService("com.liferay.portal.service.GroupService"))

#set ($current_group = $groupService.getGroup($company_id, "group_.name"))
thumbnail
8年前 に Jack Bakker によって更新されました。

RE: in velocity navigation.vm from another site

Liferay Master 投稿: 978 参加年月日: 10/01/03 最新の投稿
oh, I see, use:

#set ($layoutLS = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set ($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))

#set ($current_group = $groupLocalService.getGroup($company_id, "group_.name"))
thumbnail
8年前 に Jack Bakker によって更新されました。

RE: in velocity navigation.vm from another site

Liferay Master 投稿: 978 参加年月日: 10/01/03 最新の投稿
I am hijacking my own thread. Working on having a main navigation.vm in a theme that uses pages from 'one' chosen site regardless of which site the theme is used in. Below seems to work:


#set ($layoutLS = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService"))
#set ($groupLocalService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))

#set ($current_group = $groupLocalService.getGroup($company_id, "site name here, from table: group_ ; field: name"))
#set ($current_layouts = $layoutLS.getLayouts($current_group.getGroupId(), false, 0))

#set ($notHiddenLayouts = [])
#foreach ($current_layout in $current_layouts)
	#if (!$current_layout.isHidden())
		#set($dud = $notHiddenLayouts.add($current_layout))
	#end
#end

#set ($NavItem = $portal.getClass().forName("com.liferay.portal.theme.NavItem"))
#set ($current_nav_items = $NavItem.fromLayouts($request, $notHiddenLayouts, null))

#*
company_id: $company_id<br>
group local service: $groupLocalService<br>
current_group: $current_group<br>
groupId: $current_group.getGroupId()<br>
NavItem: $NavItem<br>
current_nav_items: $current_nav_items
*#




In portal-ext.properties, I have the following. One of the lines below needed to get at NavItem...


velocity.engine.restricted.classes=
velocity.engine.restricted.variables=
freemarker.engine.restricted.classes=
freemarker.engine.restricted.variables=