By default we will have following property which won't allow us to use serviceLocator variable in velocity templates.
#
# Input a comma delimited list of variables which are restricted from the
# context in Velocity based Journal templates.
#
journal.template.velocity.restricted.variables=serviceLocator
In order to access you need to change that property as below
journal.template.velocity.restricted.variables=
Call the service in Theme as shown below.
#
# Input a comma delimited list of variables which are restricted from the
# context in Velocity based Journal templates.
#
journal.template.velocity.restricted.variables=serviceLocator
In order to access you need to change that property as below
journal.template.velocity.restricted.variables=
Call the service in Theme as shown below.
#set ($myLocalService = $serviceLocator.findService("test-portlet", "com.test.MyLocalService"))Access util class using findUtil Method for inbuilt Util of Liferay,Shown below.
$myLocalService .getTestCount()
#set ($journalContentUtil = $utiLocator.findUtil("com.liferay.portlet.journalcontent.util.JournalContentUtil"))
No comments:
Post a Comment