cookpau01
08-31-2010, 08:11 PM
I am working with a CSS template:
I am wanting to change my header image for each page. I have read some information on how to do this and have come to conclusion that some PHP has to be used. I have found in the CSS behind my template the code the displays the current header image:
#header { float:left; width:880px; height:330px; background:url(../images/header.jpg); background-repeat:no-repeat; }
I have also found some code examples of how to change the image for each page:
<?php
if ($node->nid == 1) {
print 'image-1.jpg" />';
}elseif ($node->nid == 2){
print 'image-2.jpg" />';
}elseif ($node->nid == 3){
print 'image-3.jpg" />';
}elseif ($node->nid == 4){
print 'image-4.jpg" />';
}elseif ($node->nid == 5){
print 'image-5.jpg" />';
}elseif ($node->nid == 6){
print 'image-6.jpg" />';
}elseif ($node->nid == 7){
print 'image-7.jpg" />';
}elseif ($node->nid == 8) {
print 'image-8.jpg" />';
}elseif (($node->nid == 9) | ($node->nid == 10)){
print 'image-9.jpg" />';
}elseif ($node->nid == 11) {
print 'image-11.jpg" />';
}else {
print 'default-image.jpg" />';
}?>
I am struggling to work out how to integrate the PHP into the existing CSS.
Any help would be much appreciated. :thumbsup:
I am wanting to change my header image for each page. I have read some information on how to do this and have come to conclusion that some PHP has to be used. I have found in the CSS behind my template the code the displays the current header image:
#header { float:left; width:880px; height:330px; background:url(../images/header.jpg); background-repeat:no-repeat; }
I have also found some code examples of how to change the image for each page:
<?php
if ($node->nid == 1) {
print 'image-1.jpg" />';
}elseif ($node->nid == 2){
print 'image-2.jpg" />';
}elseif ($node->nid == 3){
print 'image-3.jpg" />';
}elseif ($node->nid == 4){
print 'image-4.jpg" />';
}elseif ($node->nid == 5){
print 'image-5.jpg" />';
}elseif ($node->nid == 6){
print 'image-6.jpg" />';
}elseif ($node->nid == 7){
print 'image-7.jpg" />';
}elseif ($node->nid == 8) {
print 'image-8.jpg" />';
}elseif (($node->nid == 9) | ($node->nid == 10)){
print 'image-9.jpg" />';
}elseif ($node->nid == 11) {
print 'image-11.jpg" />';
}else {
print 'default-image.jpg" />';
}?>
I am struggling to work out how to integrate the PHP into the existing CSS.
Any help would be much appreciated. :thumbsup: