Having a different background image for different pages
Permalink
I want a few pages on the site I am building to have a different background. Here are examples (this is not my site)
http://www.beavermtn.com/about-beaver-mountain/lets-get-started.htm...
http://www.beavermtn.com/meet-our-family/presidents-message.html...
Some of their pages have the same background but a few have a different background. It is not something that is random, meaning that when you reload the page you see a different background. The backgrounds are specific to a page.
Any ideas on how to do this with c5?
http://www.beavermtn.com/about-beaver-mountain/lets-get-started.htm...
http://www.beavermtn.com/meet-our-family/presidents-message.html...
Some of their pages have the same background but a few have a different background. It is not something that is random, meaning that when you reload the page you see a different background. The backgrounds are specific to a page.
Any ideas on how to do this with c5?
I did it a little differently. I added a 'select' page attribute called 'background_style' and added 4 descriptions for the 4 different backgrounds I'd like to use. In my case I used 'Carpentry', 'Cabinetry', 'Designer', 'Contractor' to describe the background I wanted to use on the page. I then added this to the top of the page:
And then added this to the body tag to assign a different class to the body pulled from the attribute selected:
then my css file has:
When I add a page, I just choose an appropriate page 'genre' from the drop-down.
I'm not sure if that's a simpler concept but I find it works for me and keeps the design in the hands of the designer.
<?php global $c; ?>
And then added this to the body tag to assign a different class to the body pulled from the attribute selected:
<body class="<?php echo $c->getCollectionAttributeValue('background_style');?>"
then my css file has:
.Carpentry {background-image:url('carpentry-background.jpg')} .Cabinetry {background-image:url('cabinetry-background.jpg')} .Designer {background-image:url('designer-background.jpg')} .Contractor {background-image:url('contractor-background.jpg')}
When I add a page, I just choose an appropriate page 'genre' from the drop-down.
I'm not sure if that's a simpler concept but I find it works for me and keeps the design in the hands of the designer.
http://www.concrete5.org/documentation/how-tos/designers/use-attrib...