Labels

Learn the powerful enterprise adaptable database:

Getting Started With ADABAS & Natural

Sunday, March 31, 2013

Liferay 6.1: Customizing portal_normal.vm


All Liferay themes make use of this Velocity template engine. A template engine is software that is designed to process web templates (in this case files with a vm extension) to produce output web documents. These web documents are mostly HTML or XML files, but it can also be complete different things like CSS or JS files.

Using a template engine also separates business logic from presentation, which gives the maintainability of your source code a boost. This is also known as the MVC software architecture. In the controller section of your web application you can set variables which you can use to display or do other things in the view section of your web application.

1) Run Eclipse.

2) Go to File/New/Liferay Project.

Fill in my-template-1 for the Project name and My Template 1 for the Display name.
Select the Liferay Plugins SDK and Portal Runtime you’ve configured.
Select Theme for your Plugin type.
Click Finish.

3) The project folder is created.

4) Open build.xml.
replace "_styled" with "classic".

5) Create a new folder "template" under _diffs folder.

6) Copy file portal_normal.vm into _diffs/template folder.

7) Replace the line:

#if(!$is_signed_in)
<a href="sign_in_url" id="sign_in" rel="nofollow"> $sign_in_text </a>
#end

With:

#if (!$is_signed_in)
<form action="" method="get">
<input id="sign-in" type="submit" value="Log In" />
</form>
#end

8) Deploy.


No comments:

Post a Comment