Sunday, December 13, 2015

Getting current page URL in VM file liferay

The below example will help you to fetch the current URL of the page by using Group and display different images based upong the URL. 

<div id="nav" class="nav">
#set ($groupService = $serviceLocator.findService("com.liferay.portal.service.GroupLocalService"))
#set ($group = $groupService.getGroup($getterUtil.getLong($group_id)))
#set ($groupurl = $group.getFriendlyURL())
#set ($groupurl2 = "/web"+$groupurl+"/my-account" )
#set ($groupurl3 = "/web"+$groupurl+"/my-profile" )

#if ($is_signed_in)

#if ($theme_display.getURLCurrent().contains($groupurl2))

#else
<a href="/web$groupurl/my-account">
<img alt="$logo_description" src="$images_folder/mts/myaccount.png" width="100%" />
</a>
#end

#if ($theme_display.getURLCurrent().contains($groupurl3))

#else
<a href="/web$groupurl/my-profile">
<img alt="$logo_description" src="$images_folder/mts/myprofile.png" width="100%" />
</a>
#end

#end
</div>

Liferay DXP JNDI Data Source Cofiguration

 This Blog will help us to learn about the JNDI Data Source Configuration in Liferay DXP. We have tested this with Liferay 7.3 with Tomcat. ...