How to get Theme Context path in Liferay CMS velocity template

This is how you  get the theme context path in a velocity webcontent template in Liferay.

#set ($pathThemeImages = $xmlRequest.replaceFirst('(?s).*<path-theme-images>(.*)</path-theme-images>.*', '$1'))
#set ($themeContextName = $pathThemeImages.replaceFirst('http.*//(.*)/(.*)/images', '/$2'))
$themeContextName
Advertisements