Changing background with every page.
Permalink
Hello. I'm fairly new to Concrete5. I have been developing a website for a client in which they would like the background image to change with each page. With the theme I'm developing, I can get this to happen using this code for the change. This is the code for bgchange.php, which echos out css into style tags in my default.php.
and here is where it goes
it looks like it is working, except that no image is displayed.
The color is green if the url's match and red if not.
I could use an explanation or some help as to what I need to do to get the Background to change.
Any help is appreciated.
Thanks!
and here is where it goes
<style type="text/css"> <?php include 'bgChange/bgchange.php';?> </style>
it looks like it is working, except that no image is displayed.
The color is green if the url's match and red if not.
I could use an explanation or some help as to what I need to do to get the Background to change.
Any help is appreciated.
Thanks!
Thank you so much!
I found where my issue was from the last line you posted.
I was in fact losing the image because I wasn't linking it properly.
What I ended up doing was adding "themes/myTheme/" before the "images/backgrounds/people.png" and TAH-DAH!
I'm going to have to read up more on the way concrete uses the classes before I try the other method you mentioned.
Thanks again!
I found where my issue was from the last line you posted.
I was in fact losing the image because I wasn't linking it properly.
What I ended up doing was adding "themes/myTheme/" before the "images/backgrounds/people.png" and TAH-DAH!
I'm going to have to read up more on the way concrete uses the classes before I try the other method you mentioned.
Thanks again!
Hi I've just tried and tried to do as you say above, but BG not showing up any help would be appreciated. See extract code from:
main.css
body {/* customize_background */ background-color: #000000; /* customize_background */ padding: 0px; margin: 0px; }
body.home { background-image:"images/main-bg.png"}
header.php
<body>
$c=Page::getCurrentPage();
<body class='$c->getCollectionHandle()'>
<div id="page">
Thanks,
Alan
main.css
body {/* customize_background */ background-color: #000000; /* customize_background */ padding: 0px; margin: 0px; }
body.home { background-image:"images/main-bg.png"}
header.php
<body>
$c=Page::getCurrentPage();
<body class='$c->getCollectionHandle()'>
<div id="page">
Thanks,
Alan
try background-image: url(images/main-bg.png);
your code snippet is missing the "url()"
your code snippet is missing the "url()"
http://www.dokimos.org/ajff/
Joking aside, I would add in a different class dependant on either the page name or page class.
Then move the background image into the css,
an example would be
Then in your css, you could refer to your body images, using
body{ background-color:#333;}
body.home { background-image:url(images/image1.jpg)}
You example seems to suggest you are using php css which I dont believe will parse so wont add the needed paths to your image directory. So you would need to use relative paths to your images from the root,
/themes/your_theme/images/backgrounds/people.png