Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Zhenjun Yang
How to customize Liferay default classic theme
April 2, 2013 5:26 AM
Answer

Zhenjun Yang

Rank: New Member

Posts: 12

Join Date: February 23, 2013

Recent Posts

To customize the liferay default classic theme, I created a hook to override the index.jsp file which is located in /ROOT/html/portal/api/jsonws/, however it doesn't work. Anybody please tell me what's wrong? thanks a lot for kind support!
David H Nebinger
RE: How to customize Liferay default classic theme
April 2, 2013 5:39 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 9280

Join Date: September 1, 2006

Recent Posts

Create a new theme that uses classic as the parent theme. Make your changes in the _diffs folder, then build and deploy.
Zhenjun Yang
RE: How to customize Liferay default classic theme
April 2, 2013 8:55 AM
Answer

Zhenjun Yang

Rank: New Member

Posts: 12

Join Date: February 23, 2013

Recent Posts

David, thanks for your prompt response.

You gave me the way on how to customize a theme, I got it and thank you.
Actually I want to add a search bar in the head in classic theme, so I created a hook to override index.jsp, I just don't understand why it doesn't work...
David H Nebinger
RE: How to customize Liferay default classic theme
April 2, 2013 10:49 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 9280

Join Date: September 1, 2006

Recent Posts

You do not modify Liferay's theme, ever. You don't hook themes to affect change.

You create a custom theme which extends another theme and that is the theme where you make the change. Index.jsp has nothing to do with the actual theme being used.
Maarten van Heiningen
RE: How to customize Liferay default classic theme
April 2, 2013 11:36 AM
Answer

Maarten van Heiningen

Rank: Regular Member

Posts: 173

Join Date: February 5, 2009

Recent Posts

Hi Zhenjun,

Did you have a look at the development guide for Theme's? Do you use the Liferay IDE or Liferay Developer Studio?

Guide: http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/creating-liferay-them-7

You need also be aware of the fact there are two search portlets you can use in your theme. The full content search (searching blogs, documens and webcontent, Wiki) and the Webcontent Search portlet.

Just use this in your portal_normal.vm If you use Velocity as a theme template. You can find this in your [YOUR-OWN-THEME-ROOT]/_diffs/templates/portal_normal.vm

Option one (full search):
1<div>
2$theme.search()
3</div>


Option two (webcontent search):
1<div>
2$theme.journalContentSearch()
3</div>


But please check the documentation about how to create themes in Liferay. It will make your live much easier.

Happy development!
Maarten
Zhenjun Yang
RE: How to customize Liferay default classic theme
April 3, 2013 12:51 PM
Answer

Zhenjun Yang

Rank: New Member

Posts: 12

Join Date: February 23, 2013

Recent Posts

David and Maarten, thanks for your time and help, I have got the issue resolved. Again thanks!
Ren Rem
RE: How to customize Liferay default classic theme
April 13, 2013 9:05 AM
Answer

Ren Rem

Rank: New Member

Posts: 2

Join Date: October 2, 2012

Recent Posts

Your answer is unhelpful.

What would be really helpful is if *SOMEONE* would write a tutorial on building the Welcome theme FROM SCRATCH... or at least how to build the Welcome theme using the 6.1 SDK resources that are available.

This "build your own custom theme" advice is about as useful as teats on a bull...
David H Nebinger
RE: How to customize Liferay default classic theme
April 13, 2013 2:33 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 9280

Join Date: September 1, 2006

Recent Posts

Ren Rem:
Your answer is unhelpful.

This "build your own custom theme" advice is about as useful as teats on a bull...


Sorry, but the forum is not the place for a whole dissertation on how to build themes. Besides, from how the OP asked the question, he wanted to do a hook to override a single file of the classic theme and our responses were directly on point: do not do a hook to override a theme file, create your own custom theme that extends classic and has the changes you need. So clearly you either didn't read or didn't understand what the OP was asking for, or you would have seen our replies as being correct and on point.

As far as 'how to theme' goes, there's documentation on the portal to assist there, and I would point you to that.

Long story short:

1. create theme plugin.
2. change the parent theme to be the one that you want to extend.
3. build the theme (to pull in parent theme files).
4. in the diffs_ folder, put your override and new files (mirroring filenames and paths from docroot). Use any sass/css reference you want for doing the styling.
5. build and deploy your theme.
6. in the portal, change the theme on a page (or pages or portal) to be your newly deployed theme.
7. done

Any more detail than this is pointless because more detailed references are available.
Manisha Thote
RE: How to customize Liferay default classic theme
April 13, 2013 2:35 PM
Answer

Manisha Thote

Rank: New Member

Posts: 7

Join Date: February 13, 2012

Recent Posts

Steps to create the custom classic theme,
1)Create a new theme that uses classic as the parent theme.
2) Make your changes in the _diffs folder which include all templates as well,
3)build new theme and deploy,
Rahul Trehan
RE: How to customize Liferay default classic theme
April 17, 2013 4:46 PM
Answer

Rahul Trehan

Rank: New Member

Posts: 9

Join Date: November 17, 2009

Recent Posts

David,

Thanks for the response. I've another question. If I've a customized theme provided to me in a *.war format and I wish to extend that theme.
Firstly, Can I really do that using plugin sdk?
Secondly, How?

I created a base theme using create.bat from command line and imported that project in Liferay IDE. Then I go and copy all the changed css and images to _diff folder and
change the build.xml and set the theme.parent property to my customized theme. I"m getting the build failed errors. I even exploded the war file to project directory but It still doesn't compile.


Thanks,
Rahul
David H Nebinger
RE: How to customize Liferay default classic theme
April 17, 2013 5:54 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 9280

Join Date: September 1, 2006

Recent Posts

I would create a theme plugin in the SDK named for the theme you have in the war. This will give you the basic project. Do a build to have the sdk populate the docroot folder. Create a _diffs folder in this project and extract the appropriate contents from the war file there. You should be able to do another build and get a new war that would be similar to the war file you received (same paths, same files, same sizes...).

Once that is done, you can create a new theme project and modify the build.xml file to indicate the parent theme is "../oldtheme". Do the build here, and you get a workable starting point for your project. Make your own corrections in the _diffs folder, and you're off and running.

Should you get an updated theme.war (from wherever you're getting them), just extract appropriate contents into the _diffs folder of the first theme project and build. Then do another build in your theme project.
Rahul Trehan
RE: How to customize Liferay default classic theme
April 18, 2013 2:22 PM
Answer

Rahul Trehan

Rank: New Member

Posts: 9

Join Date: November 17, 2009

Recent Posts

Thanks David that works.