PHP Includes are great for if you just want to change a header and footer whenever you make a new layout instead of changing every single page.
1. First, your website must be php enabled, basically meaning that a lot of free sites won’t cut it.
2. Rename all your pages as .php instead of .html or .htm.
3. Make a new page called header.txt and one called footer.txt (the file extension can also be .php).
4. In the header, put all the stuff before the actual content comes. This would mean it has the top banner, title, maybe the navigation, all that jazz. In the footer put all the copyright info and ending tags for your layout such as the end div tags.
5. Then, on every page, erase the layout (if you have one) and replace it with:
..at the top of your page, and:
.. at the bottom of your page.
Wallah! Now you can change the header and footer as many times as you want
and it will be on every page.
The alternative to php(include) is php(require). Require will mean that if for some reason your header or footer doesn’t work, your page will display an error message and not show up. This is mostly useful if you’re using this to display something with a script (this is often used for forums and blogging scripts) as a security measure – in other words, if the one script isn’t working, then someone can’t breach your site’s security either. But keep in mind that for just regular headers and footers it probably isn’t necessary.