开发者

PHP header image change at every page

I build a site and now I have tho following problem. I made a file h开发者_如何学Pythoneader.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!


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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜