留言板
CSS in Liferay
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.
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.
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.
The other option, which is not very desirable, is to hard code css into the template with a selection criteria
for page and community.
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.
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.
Thanks Samuel, didn't know about that feature. Seems I still have more things to learn about Liferay.
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.
.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.
may be it's the size of the css, I'll check and post my findings
I think it was LONGVARCHAR. So the max size is around 32K.
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.
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.
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.
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