[solved] Setting Background Image based upon root-alias
Posted: Tue Dec 09, 2008 7:57 pm
I am looking to dynamically set the background image of a div based upon the $root-alias page.
The working site under development is http://69.13.130.134 and this feature is to be applied to all "inside pages", not the home.
The CSS for the div is:
#banner {
float: left;
height: 140px;
width: 100%;
background-image: url(uploads/images/banner_bg.png);
background-repeat: no-repeat;
}
and the current image is banner_bg.png
I have multiple background images in /uploads/images/banners/($root-alias)-banner.gif like admissions-banner.gif, contact-us-banner.gif if this helps.
I can't for the life of me figure out how to set the background image.
Thanks to Zoorlat - Forum Member - the template call already brings in the page name for display and a global slogan on top of the background image. Ref: http://forum.cmsmadesimple.org/index.ph ... icseen#new but now I am getting greedy and want to set the background image too!
{* Start container (Navigation and Content columns) *}
*** THIS IS THE DIV ***
{* About Us *}
{* Determine current page for Header Identification *}
{$cgsimple->get_root_alias('','root_alias')}{$cgsimple->get_page_title($root_alias)}
{* Watching puppies get born never gets old. *}
{if $root_alias eq "about-us"}{global_content name="about-us"}
{elseif $root_alias eq "get-involved"}{global_content name="get-involved"}
{elseif $root_alias eq "admissions"}{global_content name="admissions"}
{elseif $root_alias eq "graduate-services"}{global_content name="graduate-services"}
{elseif $root_alias eq "news-information"}{global_content name="news-information"}
{elseif $root_alias eq "contact-us"}{global_content name="contact-us"}
{/if}
I am a real noob and would appreciate a complete code solution once again!
THANKS!
360TRUE
The working site under development is http://69.13.130.134 and this feature is to be applied to all "inside pages", not the home.
The CSS for the div is:
#banner {
float: left;
height: 140px;
width: 100%;
background-image: url(uploads/images/banner_bg.png);
background-repeat: no-repeat;
}
and the current image is banner_bg.png
I have multiple background images in /uploads/images/banners/($root-alias)-banner.gif like admissions-banner.gif, contact-us-banner.gif if this helps.
I can't for the life of me figure out how to set the background image.
Thanks to Zoorlat - Forum Member - the template call already brings in the page name for display and a global slogan on top of the background image. Ref: http://forum.cmsmadesimple.org/index.ph ... icseen#new but now I am getting greedy and want to set the background image too!
{* Start container (Navigation and Content columns) *}
*** THIS IS THE DIV ***
{* About Us *}
{* Determine current page for Header Identification *}
{$cgsimple->get_root_alias('','root_alias')}{$cgsimple->get_page_title($root_alias)}
{* Watching puppies get born never gets old. *}
{if $root_alias eq "about-us"}{global_content name="about-us"}
{elseif $root_alias eq "get-involved"}{global_content name="get-involved"}
{elseif $root_alias eq "admissions"}{global_content name="admissions"}
{elseif $root_alias eq "graduate-services"}{global_content name="graduate-services"}
{elseif $root_alias eq "news-information"}{global_content name="news-information"}
{elseif $root_alias eq "contact-us"}{global_content name="contact-us"}
{/if}
I am a real noob and would appreciate a complete code solution once again!
THANKS!
360TRUE