PHP Includes
PHP includes is a very important tool in updating your weblayouts easily. It is very similar to Server Side Includes, the only difference is, using PHP includes will enable you to use other PHP scripts/snippets.
The first thing you need to do is to code your layout the ordinary HTML way. Then divide your layout into 3 parts. The header, content, and footer parts. The header shall contain all your codes before the contents of the page, and the footer shall include the codes after the contents of the page.

On your index.php page put the following code:
<? include("header.php") ?>
PUT YOUR CONTENTS HERE!
<? include("footer.php")?>
To create a new page just put the contents between the header code and footer code. It's just that simple. Don't forget to save your files with a .php extension!
Labels: basic, php, php inludes, tutorial
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home