Tuesday, January 1, 2013

How to Display Theme Images in Portlet or Jsp Page,Liferay

First we need to reference the liferay theme tag library then only we can able to liferay theme tags

ex  :-  xmlns:liferay-theme="http://liferay.com/tld/theme"

Then Next in the JSP Page we need to instantiate the liferay objects

<liferay-theme:defineObjects />
Now the following objects are available:
  • themeDisplay - com.liferay.portal.theme.ThemeDisplay
  • company - com.liferay.portal.model.Company
  • account - com.liferay.portal.model.Account (deprecated)
  • user - com.liferay.portal.model.User
  • realUser - com.liferay.portal.model.User
  • contact - com.liferay.portal.model.Contact
  • ?layout - com.liferay.portal.model.Layout
  • ?layouts - List<com.liferay.portal.model.Layout>
  • plid - java.lang.Long
  • ?layoutTypePortlet - com.liferay.portal.model.LayoutTypePortlet
  • portletGroupId - java.lang.Long
  • permissionChecker - com.liferay.portal.security.permission.PermissionChecker
  • locale - java.util.Locale
  • timeZone - java.util.TimeZone
  • theme - com.liferay.portal.model.Theme
  • colorScheme - com.liferay.portal.model.ColorScheme
  • portletDisplay - com.liferay.portal.theme.PortletDisplay
Example : To display the image following code is sample code.

<img src="${themeDisplay.pathThemeImages}/foldername/Sample.png"/>
 themeDisplay.pathThemeImages :- It will give the path upto the images folder in theme.

foldername :- If you have created any folder inside the images folder of theme

Sample.png :- the image which u want to display in the jsp page

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. ...