Step One: Dividing your content
(note: I recommend making a new folder for all these files. It will make things easier.)First, we'll use a basic HTML template to practice with. In this tutorial, we are going to devide the HTML into 3 parts: Header, content, and footer. Copy and paste this code into Notepad:
<html>
<body>
I want this to be included...
</body>
<head>
<title>TITLE HERE</title>
</head>
</html>
Cut all the coding in green, open a new Notepad file, and paste it in. Save it as "footer.php".
Leave all the coding in blue in the original Notepad file, and save it as "index.php" or any other name.
Step Two: The Magic of PHP!
Open "index.php" or whatever you called it. At the VERY top of the code, add this:<? include ('header.php') ?>
At the VERY bottom of the code, add this:
<? include ('footer.php') ?>
Upload index.php, header.php and footer.php to your server. Go to http://yoururl.com/index.php or wherever the index.php is located, and the header and footer should be there. If they are, congratulations! You've managed to use PHP Includes!
Server Side Include
If your host does not support PHP, hopefully, it supports SSI. SSI stands for Server Side Include, and is exactly the same thing as PHP Includes, only the code you use is different. (obviously) To include the headers and footers, you'll have to use this coding, and rename all your pages to pagename.shtml:<!--#include virtual="header.html"-->
<!--#include virtual="footer.html"-->