Showing posts with label Liferay. Show all posts
Showing posts with label Liferay. Show all posts

Thursday, April 30, 2015

Implementing Application Display Template in Custom Portlet


In the following post we will see how to implement Application Display Template to a custom portlet. We are assuming that we have a custom portlet as created in previous post.

Following are steps that we need to follow -


1. Create StudentPortletDisplayTemplateHandler.java class. This class extends BasePortletDisplayTemplateHandler class provided by Liferay.


2. Declare StudentPortletDisplayTemplateHandler class in liferay-portlet.xml file.


3. Configure permissions to allow users to manage application display templates.


4. Use tag to show ADT options in configuration jsp.



5. Update the view jsp to render the data using selected ADT.



6. Create the template and test. Following Freemarker sample code snippet is from liferay documentation page.



Please share your feedback if any ....

Wednesday, February 23, 2011

Creating and Applying Different Liferay themes to Pages

Here is an example of how to apply different themes on pages in Liferay. Here we have created two themes-

1. First of all in the liferay-look-and-feel.xml file, create two different theme entries that refer to the same theme but have a different value for the header-type setting:


Both the theme entries refer to same theme but they different value for their header-type setting. We can access the settings programmatically in our theme template and then take action based on the settings we have defined.

When this theme is deployed to Liferay, it will display to the user as two different themes.

2. Accessing the settings in portal_normal.vm template file




In the above code we accessed the settings defined in the liferay-look-and-feel.xml file and based on the value of the setting we are parsing different template files.