Reputation: 299
I build a site and now I have tho following problem. I made a file header.php and footer.php These contain the top and bottom of my template. I did this so when changes made at the template I wont have to change it to every individual page.
Now my question is... Every page has a image header like "home" "portfolio" "faq"... and I want the image to change on everypage. When the page is index.php then it shows home.png and when were at faq.php it shows faq.png.
This is basicly my code:
<?php include ("header.php") ?> (this file contains the header image)
Content here
<?php include ("footer.php") ?>
I hope I you guy's understand it. If not, let me know and i'll try to make a better discription.
Thanks in advance!
Upvotes: 0
Views: 1629
Reputation: 52372
In each page (index.php, faq.php, etc.) set the name of the image you want to show before including the header file
<?php
$image = "faq.png";
include("header.php");
?>
and in header.php
<img src="<?php echo $image; ?>" alt="Header Image" />
Upvotes: 5