There is another powerful feature that we can use in Velocity templates: invoking Liferay services. Liferay services can be used to access a lot of resources of the portal.
For example, we will try to use the
LayoutLocalService. Here is the code:
#set($layoutService = $serviceLocator.findService("com.liferay.portal.service.LayoutLocalService")) #set($layouts = $layoutService.getLayouts($layout.getGroup().getGroupId(), false)) #foreach ($page in $layouts) <span>$page.getName($locale) | </span> #end
Copy this snippet of code and paste it at a convenient place in the
portal_normal.vm file. When it runs, it will print out the names of all the public pages in this community. The page names will be delimited ...