1. Customize your own Liferay Theme
a. Introduction to Liferay Themes
b. Deploy a Liferay Theme
c. Modify example theme
2. Customize your own Liferay Layout
a. Create a custom 2-3 layout
- (2-3 = 2 column row on top of a 3 column row)
a. Select different layout templates
Introduction to Liferay Themes
With themes, you can quickly & completely
redesign a website layout with a single war file.
Lets see some examples:
- Themes from Liferay Website:
- Liferay.com -> downloads -> community themes
Change the Liferay Theme
a. Startup Tomcat
b. On the Liferay website
“Page Settings” -> “Look and Feel” -> Select Theme
• Creating a theme can be a very time consuming
process, depending on what exactly needs to be done.
• Step 1: Identify the major components
Most themes contain the following elements:
• Portlet area
• Some themes that are more graphically intensive also have a top,
bottom, and left and right sides.
• Step 2: Identify the portlet areas
– The next step is to identify your portlet areas.
All portlets are composed of 12 pieces.
• Look for all 12 pieces /
images of the portlet
• Notice that some
portlets have wide
borders and some
have thin, it all
depends on how your
portlet is supposed to
• If there are shadows
you need to
incorporate the entire
shadow in your image.
Deploy your own “example.war” theme
and change Liferay’s homepage to
use that theme.
This theme will help distinguish each of
the pieces of the theme to give you
practice in editing themes.
Deploying your theme:
1. Startup Tomcat (if not already)
2. Copy “example.war” to your themes
3. “ant deploy” from your themes folder
4. Reload the page and select this theme
Step 3: Putting it all together
You will need to cut your portlets up into 12 images like shown above, then populate the 12 portlet areas based on the
images you cut up (set the height, width, and file name of each images)
Hint: look for these lines
To build the banner you need to edit:
Usually only the middle is required, but if the theme needs to stretch along the x
axis you will need left and right as well.
Top, Bottom, Left, Right
Top and Bottom Decorations
Use these to build your top and bottom decorations
Left and Right Sides
Look for these to edit the sides
Modify the example.war theme to look like the one below
• Helpful Notes:
– border-left: 1px dotted black;
– In Firefox’s web developer extensions press (CTRL-SHFT-F) for helpful HTML info
• Files to modify:
• css_cached.vm (css)
• portal_normal.vm (layout)
• liferay-look-and-feel.xml ($colorScheme)
Content and Layout
• Why new layouts?
– Variety is good
– Not all sites are the same
– Sometimes the defaults just don’t work for
• How do we do it?
– Layouttpl (Layout Template)
• 4.0.0 makes this process so much easier!
Prepare the layouts folder
• In the EXT directory navigate to the layouttpl folder
• Create a folder called sample.war here
• In sample.war, create two folders: WEB-INF and html
• We have now setup the basic folder structure for layouts.
This is the process that must always be followed for new
Preparing supporting files
• Inside the WEB-INF folder that was just created, create a
file and name it liferay-layout-templates.xml
• Now create one more file here, and call it web.xml
What did that do?
• Layout-templates is our root element, it tells Liferay that
we are defining new layouts
• Custom tells Liferay that this is not a built in template,
but something new
• Layout-template-id and name let Liferay know what to
– Display in add content
– Set as the unique id for this template
• Template-path tells Liferay where to find the template
structure (tpl) file
• Navigate to ext/layouttpl
• Run ant deploy
• Open a web browser to http://localhost
• For this example, let’s create a new page
Let’s add content!
• Click Add Content
• Select your Layout Template
• Click test and add (portlets with small width):
• Hello Laszlo
• Hello Velocity
• Hello World
• Your sample portlet
• Refresh your page
• Drag all the portlets around to fill the five
• You should now know:
– How to create a basic theme
– How to create custom layouts
– How to add new content pages
– How to use change the layout template
• Things to practice
– The more CSS and HTML you know, the
better off you will be
– Getting a theme just right takes time. Don’t
lose faith, it is possible!
Congratulations! You’ve just modified your own theme!
To hot deploy JSR-168 compliant portlets, Liferay layout templates, or
Liferay themes just drop your *.war files in C:/home/liferay/deploy
Sample portlets can be found here:
For more information on hot deploy, click here:
Scott Lee 11/2/2006
- Created & Updated slides from Brett’s Theme Docs & Layout Ppt
Scott Lee 11/10/2006
- Fixed typos (Liferay-layout-templates.xml, tpl filepath)
- added “helpful notes” for excercise
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.