Captain's Log

graphics tutorials quizzes walkthroughs reviews me

PHP Includes

PHP is a massive time saver for the larger websites. If you need to change your layout but do not want to go into every single sub-page and edit the coding, it is time to PHP-ize your site.

The whole process is surprisingly painless. Open your HTML editor if you have not already and open up one of your page files. For example purposes, imagine it looks somewhat like this:

<HTML> <HEAD><TITLE>Waffles Are Divine</TITLE></HEAD> <STYLE TYPE="TEXT/CSS"></STYLE> <BODY> <TABLE><TR><TD> Join the cult today! </TD></TR></TABLE> </BODY> </HTML>

Cut everything before "Join" and paste it into a new document. Name the new file "head.php" and return to the orginal. Now you have to cut everything after "today!" and paste it into another blank document. This time name it "foot.php" and hop back on over to the first file.

You should be left with just the sentence. Edit the coding so it looks like the following:

[? include("head.php") ?] Join the cult today! [? include("foot.php") ?]

Replace the brackets with the proper tags, then all you do is rename the file to "index.php" or whatever so long as the file extension is PHP.


All ramblings of Erica Feggestad 2000-2008