Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Will Morris
Swapping page banners within a theme
May 6, 2009 1:50 PM
Answer

Will Morris

Rank: New Member

Posts: 5

Join Date: January 21, 2009

Recent Posts

We have a page where we need to use a different banner and footer than the ones defined in portal_normal.vm.

I'm not seeing any obvious way to do this. Is there a way to make a certain page use a different portal_{x}.vm?

Or if we have to stay within portal_normal.vm, is there a way to create conditional velocity code to serve different html? What kind of hook can we use to change the html for that page?

Thanks,

- Will
Oliver Bayer
RE: Swapping page banners within a theme
May 7, 2009 1:09 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 881

Join Date: February 18, 2009

Recent Posts

Hi,

one solution would be the creation of a new theme with the liferay sdk, but it's a big overhead for the small changes you would like to do. On the other hand you can create some conditions and apply an other div with other background-images. Take a look at the init.vm inside the "webapps \ ROOT \ html \ themes \ unstyled" folder where many vm-vars are defined.

1#if ($the_title == "blabla")
2#set($cssImageClass="image1")
3#else
4#set($cssImageClass="image2")
5#end
6...
7<div id="banner" class="$cssImageClass">

In the custom.css of the theme you will have to write different classes with different background-images. This is only one possible solution and maybe not the best way (problem with multi-lingual page titles...) but maybe you can use this as a starting point.

HTH
Archi Madhu
RE: Swapping page banners within a theme
May 8, 2009 5:16 AM
Answer

Archi Madhu

Rank: Regular Member

Posts: 240

Join Date: March 24, 2008

Recent Posts

Liferay have better way to do this using color-schemes


For that we need to create an entry in liferay-look-and-feel.xml file for color-scheme

<look-and-feel>
<compatibility>
<version>5.2.2+</version>
</compatibility>
<theme id="Mytheme" name="Mytheme" >
<color-scheme id="01" name="Style1">
<css-class>style1</css-class>
</color-scheme>

<color-scheme id="02" name="Style2">
<css-class>style2</css-class>
</color-scheme>
</theme>
</look-and-feel>


and in .vm files or in css we can differ them by classname which we have given in liferay-look-and-feel.xml file for each theme

------------------ css ---------------------



.style1 #ctnr_banner {
width: 1032px;
height: 234px;
background-image: url(../images/bg_topBanner.jpg);
background-repeat: no-repeat;
vertical-align: top;
}
.style2 #ctnr_banner {
width: 1032px;
height: 234px;
background-image: url(../images/bg_topBanner2.jpg);
background-repeat: no-repeat;
vertical-align: top;
}



--------------------vm file--------------------------


#if($css_class=="style1 controls-visible")

<a href="http://www.mydesign.com""><img src="http://www.myimage1/cmp_logo.gif" width="89px" height="103px"/></a>


#elseif($css_class=="style2 controls-visible")

<a href="http://www.mydesign.com"><img src="http://www.myimage2cmp_logo.gif" width="89px" height="103px"/></a>


#end



HTH!
-Archi Madhu
Oliver Bayer
RE: Swapping page banners within a theme
May 9, 2009 6:03 AM
Answer

Oliver Bayer

Rank: Liferay Master

Posts: 881

Join Date: February 18, 2009

Recent Posts

HI Archi Madhu,

thanks for the hint, it looks promising. I'll give it a try next week.

Greets Oli