Category: Liferay

Theme Development in Liferay

LiferayUI blog will help you make you own theme to customize your liferay’s portal appearance and impression. With themes, you can alter the user interface completely that it becomes difficult yet impossible to identify that the site is running on Liferay.

Liferay’s theme inherits the styling, images, and templates from any of the built-in themes. This saves your time and keeps your themes smaller and less cluttered, because your theme contains only its own resources, using defaults for the rest, like Templates,Js,Images and CSS.

Theme Development in liferay is easy to create. You can start by making changes in the CSS files. When you need to customize themes more extensively, you can change the HTML Templates.

If you hope to become a Liferay theme development and customization expert, there are several technologies you should know:

  • CSS: Create a new theme simply by modifying a CSS file.
  • Velocity: Customize the markup generated by the theme.
  • JavaScript: Add special behaviors to your theme.
  • XML: Some theme settings are specified in XML.

Creating a Theme

Our theme will be named HM Blue, so the project name (without spaces) is hm-blue, and the display name (which can have spaces) is HM-Blue. Let’s create the theme using Liferay Developer Studio first, and then with the terminal (Command Prompt).

Using Developer Studio:

  • Go to File → New → Liferay Project.
  • Fill in HM-blue for the Project name and HM Blue for the Display name.
  • Select the build type, Plugins SDK, and Liferay runtime.

See this link if you Using Liferay IDE with Maven for more information. Otherwise, select the Ant build type.
For more information, see sections Installing the SDK and Setting Up Liferay IDE.

Select Theme for your Plugin type.

Click Next.

Theme-Creation

Figure 1 : Make sure to select the Theme plugin type for your theme.

Setting a base Theme

Now you have to Select a theme parent. In Liferay you have two base theme, all themes are built on the top of it, which is assign style and unstyled. Your newly created theme is based on these by default, but they contain very limited styling. You can take advantage of an existing theme’s styling by setting the theme of your choice as the base for your theme. styled theme providing the most basic elements. When you set a different base theme, it’s added on top of styled and overrides the default styling wherever there are differences. After the base themes are added, your own custom styling is affixed on top.

select-framework
Figure 1.1 : Make sure to select the Theme plugin type for your theme.

By Default it’s select _styled theme. Adding together in to the _styled theme, from the unstyled theme you can select the inherit, which includes no styling. There’s also the classic theme that has a smooth look and feel and works well. For now, select _styled as the theme parent.

Select your theme’s framework. You can select the Freemarker or Velocity template frameworks for your theme. Or you can select JSP as your theme’s framework. For now, select _Velocity framework template framework. See figure 1.1

Click Finish.

To specify a base theme, edit the build.xml file for your theme and change _styled in to the name of any existing theme that’s installed or in your Plugins SDK. Now that your base theme is set, let’s deploy the theme to your portal instance.

Theme Deployment

If you’re already familiar with portlet deployment then theme deployment will be a piece of cake! You can deploy your theme in Developer Studio or the terminal (Command Prompt).

Deploying in Developer Studio: Click and drag your theme project onto your server.

Theme-Deploy

After deploying, your server outputs messages in console to indicating your plugin is available for use.

  • Reading plugin package for hm-blue-theme
  • Registering themes for hm-blue-theme
  • 1 theme for hm-blue-theme is available for use

Let’s apply your theme to a page:

  • Go to your web browser and log in to the portal.
  • Hover over Manage at the top of the page and click on Page.
  • Directly underneath the words Manage Pages, select the Look and Feel tab. Click on your theme to activate it.

Redploy

Now that you’ve built and redeployed a theme, let’s see the hierarchy of theme.

What is Liferay Portal?

Liferay Portal provide you enterprise web based solutions. Collaborative websites for teams and an entire enterprise are developed with the help of portals.

Using liferay authorizing teams individuals can create their own communities,creating a web area assigning a set of collaborative tools (blog, wiki, calendar, tasks, alerts, doc sharing, etc.) through the portal to the group. All collaborations within that community can be created by an individual to which he can join and organize as well.

What is liferayUI?

The user interface of Liferay CMS consists of Portal that contain UI elements. The UI element is a page or a part of the page that contains CMS that is shown to the end user. The UI Personalization is available to extend to the UI elements like Menu,Tabs,forms,text and group of controls etc. There is lot’s of framework available in the market to customize your UI of Application. AlloyUI is one of the UI frame which is developed on top of the YUI3 that offers an easy API for constructing high scalable applications. It’s maintained by liferay engineers. When you develop component using AlloyUI scripts in the portal, you can reuse them anywhere else.

What is Liferay?

Liferay is an open source portal based on a web solution providing to the enterprise a web platform for building solutions that delivers immediate result. Liferay is one of the most prominent open source for websites content management solution.

The reasons to use Liferay Portal for your website is simple:

  • It provides a robust platform to serve your site to all clients, be it desktop, mobile, or anything in between.
  • It provides all the standard applications you need to run on your site.
  • It provides an easy to use development framework for new applications or customization.

In addition to this, Liferay Portal is developed using an open source methodology, by the people from all over the world. The coding is reliable, and has been verified to be consistent and secure in mission of critical deployments in diverse industries.

Let’s see how Liferay Portal handles the assigned job:

  1. BUILDING A SITE WITH LIFERAY WEB CONTENT
  2. USING LIFERAY PORTAL AS A COLLABORATIVE PLATFORM
  3. USING LIFERAY AS A WEB PLATFORM
  4. EXTENDING AND CUSTOMIZING LIFERAY FOR YOUR OWN NEEDS

So what is Liferay? As you can spot, it’s hard to exemplify, as it does too much. What we’ve essentially to say it’s totally an awesome content and document managing, user collaborating, socially enabling, application developing, corporate integrating, and completely customizable platform for building the internet.

To know more about Liferay. Please visit Liferay.com