Saturday, March 27, 2010

Creating Liferay Themes

Liferay Themes customize the overall look and feel of Liferay and were introduced in version 3.5 of the portal. There are two ways to develop themes for Liferay. They are using,
  • Liferay Plugins SDK
  • Using Portal Pack on NetBeans IDE With Theme Plugin Support

Here I explained how to develop themes using Portal Pack on NetBeans. Before you start, install the Portal Pack 3.0.2 plugins on NetBeans IDE 6.5, 6.5.x, or 6.7 version. You can download the latest Portal Pack plugin from here.

You can refer this to Install the portal pack plugins and add the Liferay server to NetBeans.

Create a Web Application That Uses Liferay Portal Server as the Target Runtime:
  • Choose New Project from the File menu.
  • By default, Java Web and Web Application are selected from Categories and Projects respectively.
  • Click Next.
  • Type a name for the project, and click Next.
  • In this example, name the project CustomTheme.
  • Select WLiferay Portal Server5.1.x/5.2.x as the server, and click Next.
  • Click Finish.
To Create a Liferay Theme:
  • Right-click the project (CustomTheme) and choose New → Other.
  • A window appears.
  • Choose WebSpace/Liferay Plugins from Categories and Import/Create New Themefrom File Types, and click Next.
  • Type a Theme ID and Theme Name. You can also specify a theme folder.
  • In this example, use Custom_theme and Custom Theme as the Theme ID and Theme Name respectively. If you are creating more than one theme, it is better to create a Theme Folder as well.
  • Click Finish.
Making Changes to the Theme:
  • You can change the theme by adding new images to images/common folder and edit the custom.css file.
Deploy the theme:
  • To deploy the custom theme, right-click the project and choose Deploy.
  • The theme is deployed to the Liferay Server, and you can apply the theme to the Liferay instance on your machine.
Build a .war file of the theme:
  • Copy the folder of the theme (Which is in Liferay webapps folder) to a seperate location.
  • Using command prompt navigate to that folder location.
  • Then enter the following command in the command prompt.
jar -cvf themename.war *
  • Then it will create a file called themename.war file and you can use it to deploy in other liferay instances.


  1. Is there any benefit in using the NetBeans method over the Plugins SDK method to create a theme ?

  2. As I see one advantage of using NetBeans portal pack is it gives the IDE support and it helps lot when writing codes. And when using the Liferay Plugins SDK we have to use ant for compile and create war files of the portlets.
    But with NetBeans we can create a portlet with few clicks.......