Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Roman Hoyenko
CSS in Liferay
September 6, 2011 12:17 PM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

Is there a way to have a separate CSS defined per page or per community in Liferay?

I want users to be able to define some of their own css without using Advanced Styles of the portlet - using Advanced Styles makes the management of CSS files pretty complex, if something changes we need to update several places.
Hitoshi Ozawa
RE: CSS in Liferay
September 19, 2011 8:57 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Page and community information is stored in the database so I think you'll have to use Advanced Style.

The other option, which is not very desirable, is to hard code css into the template with a selection criteria
for page and community.
Samuel Kong
RE: CSS in Liferay
September 19, 2011 11:07 PM
Answer

Samuel Kong

LIFERAY STAFF

Rank: Liferay Master

Posts: 979

Join Date: March 10, 2008

Recent Posts

1. Dockbar > Manage > Page
2. Find the "Look and Feel" (there's two. One for the whole community and one for just the current page)
3. Look and Feel > Regular Browsers > CSS

This is similar to the Advance Style of the portlet, but the CSS is attached to the community/page instead of a portlet.
Hitoshi Ozawa
RE: CSS in Liferay
September 20, 2011 2:25 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Thanks Samuel, didn't know about that feature. Seems I still have more things to learn about Liferay.emoticon
Roman Hoyenko
RE: CSS in Liferay
September 20, 2011 1:09 PM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

Thanks, that would help us a lot!
Roman Hoyenko
RE: CSS in Liferay
September 21, 2011 2:29 PM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

Ok, I tried it and it looks like when I have more or less complex rules like

.link-box ul li {
vertical-align:top;
}

it says:

You have entered invalid data. Please try again. Can we avoid the check? Looks like this is a bug.
Hitoshi Ozawa
RE: CSS in Liferay
September 21, 2011 4:06 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

I was able to save it without any problem on 6.0.6 Tomcat bundle.
Attachment

Attachments: css.jpg (26.3k)
Roman Hoyenko
RE: CSS in Liferay
September 22, 2011 6:07 AM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

may be it's the size of the css, I'll check and post my findings
Hitoshi Ozawa
RE: CSS in Liferay
September 22, 2011 6:29 AM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

I think it was LONGVARCHAR. So the max size is around 32K.
Roman Hoyenko
RE: CSS in Liferay
September 22, 2011 9:11 AM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

Do you know the table it is stored in? May be I can change it to CLOB so the size is not limited.

But I don't think our CSS was even 32k, most likely it's 4000 bytes varchar2. I looked at the Layout table, it has CSS column and it's 4000 bytes, which I think is clearly not enough.

I'll try changing to clob and see if this works.

P.S. Looks like Layout is the table for individual pages and LayoutSet is for the community. They all have 4k limit (at least in Oracle). If the pages are more or less complex 4k is not nearly enough.
Roman Hoyenko
RE: CSS in Liferay
September 22, 2011 3:12 PM
Answer

Roman Hoyenko

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

Ok, changing the table from Varchar(4000) to CLOB worked, I can save longer CSS
Hitoshi Ozawa
RE: CSS in Liferay
September 22, 2011 3:40 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7990

Join Date: March 23, 2010

Recent Posts

Wow! Thank you for sharing the information. I'll remember it. emoticon
Milen Dyankov
RE: CSS in Liferay
November 9, 2011 5:07 AM
Answer

Milen Dyankov

Rank: Regular Member

Posts: 173

Join Date: September 23, 2009

Recent Posts

For community scoped CSS which are themes independent, you may find Custom Global Markup portlet useful. Here is some more info about it: http://milen.commsen.com/2010/04/custom-global-markup-portlet.html
Samuel Kong
Thread Split
January 30, 2012 1:52 AM
Answer

Samuel Kong

LIFERAY STAFF

Rank: Liferay Master

Posts: 979

Join Date: March 10, 2008

Recent Posts

Message is slightly off topic, so I'm creating a new thread. The new thread can be found at http://www.liferay.com/community/forums/-/message_boards/view_message/12211457.