PHP Includes is used to INCLUDE a certain file into another file. It is useful because you don't have to change single page when you're
trying to update something. This is a much better option compared to iFrames.
Read this before starting!
There are a certain things you should do before you start.
- Remember that your CSS should be in a STYLESHEET.
- Validate your CSS. Click here to validate.
- Your pages should all be in PHP. Not in html. If you use freewebs or other hosts that don't provide PHP support, then you can't use PHP Includes.
I suggest you go use iFrames then.
Now make sure you've done all that.
PHP Includes
header.php
Firstly make a page called header.php. It MUST be called header.php don't change it to anything else.
The header.php is where you put your top image and sidebar. Or anything else. Just DO NOT put your content here. Your content means for example your blog. Or big box that all this text is, is called the content.
At the top of the header.php document put the following :
You don't need to close your html and body tags because this will be done in the footer.
After that code you can put your top image and sidebar and stuff. If you need a guide of what to put, you go check out my header as a guidance.
The header.php is where you put your top image and sidebar. Or anything else. Just DO NOT put your content here. Your content means for example your blog. Or big box that all this text is, is called the content.
At the top of the header.php document put the following :
You don't need to close your html and body tags because this will be done in the footer.
After that code you can put your top image and sidebar and stuff. If you need a guide of what to put, you go check out my header as a guidance.
footer.php
Now create a page called footer.php.
The footer is the stuff that goes at the bottom of the page. Mainly you just have to put your closing tags here. Paste the following in your footer.php
Or you can also put some back forward links or a copyright here if you want. Like I did. If you want do this I suggest you check out my footer page.
The footer is the stuff that goes at the bottom of the page. Mainly you just have to put your closing tags here. Paste the following in your footer.php
Or you can also put some back forward links or a copyright here if you want. Like I did. If you want do this I suggest you check out my footer page.
Include other Pages
In the pages you want to have the same layout. Paste the following code :
Just remove the spaces between < ? and ? >
Anytime you want to change your layout simply edit the header.php page.
Just remove the spaces between < ? and ? >
Anytime you want to change your layout simply edit the header.php page.
And you're done
And there you go. You're done! That wasn't too hard. If this doesn't work feel free to contact me.

