掲示板

Best way to add a new custom class at body class="" level for just 1 pg?

11年前 に Scott Hanson によって更新されました。

Best way to add a new custom class at body class="" level for just 1 pg?

New Member 投稿: 12 参加年月日: 12/09/05 最新の投稿
I'm trying to figure out the best way to add a custom background image to the first page on our site. After that I am OK with one body background the rest of the site.

It seems like the only way you can access the <body class=""> is at through portal_normal.vm. That would affect every page in the site.

I have a custom layout designed for our login page which is great--but it that doesn't give me a way to reach up high enough to put a custom background in for just this page.

What would be the best way to do this? Thanks.
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: Best way to add a new custom class at body class="" level for 1 site pa

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
1. create your standard theme.
2. create a new theme which uses the theme from #1 as the parent.
3. make appropriate changes.
4. use this theme as the theme for the main page.

Using this path, standard theme changes go into the primary theme and will get propagated to the override theme for the main page. Adds an extra theme project to deploy and maintain, but it will give you what you're looking for...
11年前 に Scott Hanson によって更新されました。

RE: Best way to add a new custom class at body class="" level for 1 site pa

New Member 投稿: 12 参加年月日: 12/09/05 最新の投稿
David H Nebinger:
1. create your standard theme.
2. create a new theme which uses the theme from #1 as the parent.
3. make appropriate changes.
4. use this theme as the theme for the main page.

Using this path, standard theme changes go into the primary theme and will get propagated to the override theme for the main page. Adds an extra theme project to deploy and maintain, but it will give you what you're looking for...


Thanks for the suggestion! Unfortunately, the developers here will never go for a multiple-theme solution just to accomplish this. That really seems like a lot of work just to add a background image to one page.

Has anyone tried to inject something into a body tag using JQuery or YUI in a script coming from a Portlet or a custom layout before? That's the only thing I can think of to make this work. It seems like Liferay should have some better way to accomplish this.
thumbnail
11年前 に David H Nebinger によって更新されました。

RE: Best way to add a new custom class at body class="" level for 1 site pa

Liferay Legend 投稿: 14916 参加年月日: 06/09/02 最新の投稿
Hmm, well how about a color scheme in a single theme?

You can have multiple color schemes, but they don't really imply it is just for colors. The color scheme can have different css...

So the primary color scheme does not have the extra background image but a secondary color scheme does.

The primary color scheme is used on all pages, but the front page uses the secondary color scheme and gets the extra background image.
11年前 に Scott Hanson によって更新されました。

RE: Best way to add a new custom class at body class="" level for 1 site pa

New Member 投稿: 12 参加年月日: 12/09/05 最新の投稿
It looks like I'm going to throw this in using an absolute position block hardcoded into the new layout (tpl) file I created (with a z-index below everything else).

It works, and seems the only reasonable way to do this without more extensive work...