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>
<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>
No comments:
Post a Comment