掲示板

Dynamically add css to portlet

thumbnail
13年前 に yan paing によって更新されました。

Dynamically add css to portlet

Regular Member 投稿: 128 参加年月日: 10/03/11 最新の投稿
Hi everyone,
I would like to know how to add css dynamically to portlet.

Our requirement is ...
I have more than one community.
I have each theme for each community.
I put all css for each community under theme.
Everything is fine in firefox and safari.
But for IE there have IE limitation on css (http://acidmartin.wordpress.com/2008/11/25/the-32-external-css-files-limitation-of-internet-explorer-and-more/)

So i am trying to move some css under respective portlet.
For doing this what i found is.

under liferay-portlet.xml
<portlet>
<portlet-name>CommunityMembers</portlet-name>
<icon>/icon.png</icon>
<indexer-class>com.platform.srv.user.model.Indexer</indexer-class>
<open-search-class>com.platform.apps.individual.search.MemberOpenSearchImpl</open-search-class>
<instanceable>false</instanceable>
<header-portlet-css>/css/main.css</header-portlet-css>
<footer-portlet-javascript>/js/main.js</footer-portlet-javascript>
<css-class-wrapper>CommunityMembers-portlet</css-class-wrapper>
</portlet>


So i want to add css dynamically according to the community name.
For example if the current community name is ABC the css shoule be <header-portlet-css>/css/abc.css</header-portlet-css>

Is it possible for doing this.
If anyone know please share knowledge.

Thanks in advance,
Yan Paing
thumbnail
13年前 に Olaf Kock によって更新されました。

RE: Dynamically add css to portlet

Liferay Legend 投稿: 6400 参加年月日: 08/09/23 最新の投稿
If you're running the portlet in production mode, all the css files from the theme should be minified and collected in a single css file.

You might be able to work around this issue by adding the CSS for the portlets to the theme - this limits the amount of css to the required minimum. For example, to style liferay's Sign-In portlet, you can address it in css with
.portal-login {
   margin: 10px;
}

Similar things can be done with your own portlets - you'll obviously only need to add the css relevant to your current theme and refer in there to the portlets you expect to be deployed in your installation
thumbnail
13年前 に yan paing によって更新されました。

RE: Dynamically add css to portlet

Regular Member 投稿: 128 参加年月日: 10/03/11 最新の投稿
Thanks for answer Olaf.
Now i just fixed this issue by moving some css to templates folder velocity micro file and it is working fine.
Thanks,
Yan
thumbnail
11年前 に Path Finder LifeRay によって更新されました。

RE: Dynamically add css to portlet

Expert 投稿: 262 参加年月日: 09/09/18 最新の投稿
yan paing:
Thanks for answer Olaf.
Now i just fixed this issue by moving some css to templates folder velocity micro file and it is working fine.
Thanks,
Yan


i will extend your query please answer this. i have my portal where i need to change the background color of the whole portal i.e in the wrapper in general we will do that(modifying in the concern css file).
i need to do this modification inside the portal like the way we are doing with portlets look and feel

is that possible ?? on a fly can i change the background of the whole portal without deploying it??

regards
path