You can get an introduction to the power and potential of PHP coding by performing this practice coding technique, which only uses the “include” php command. For this example, we’ll pretend to build a simple personal site, which assumes you want every page to be pretty much the same, except for the content.
First, you create a .php file with the basics of the code: Doctype, the <head>, the <body>, and within the body you write a header, a blank navigation bar, a paragraph about yourself and a footer. You add CSS to give it that look you want, but you decide you want to expand. This is where includes come in.
We’ll start right at the beginning with the Doctype. You know you want the same Doctype for every page, and after that there are the <HTML> and <head> tags which will appear on every page as well. Cut this out of the original document and call it something you can easily identify, like “start.html”. Where it used to be in your original PHP document, put the code <?php include(“start.html”); ?> (assuming you’re going to upload both files to the same directory).

The next section is for the meta tags, but now you have to decide what will be best to keep in a file where it will all be the same, and what will have to be changed around for every page you make. Lets say you want to make other pages for your hobbies, your pet, and your travel photos. The title will have to change every time, so keep that out. Your stylesheet, however, is something which will appear on every page (assuming you want them all to look similar) so the code calling for your .css file will go in our next file. Let’s call it “meta.html” for this example. Again, in the place of your old code, put <?php include(“meta.html”); ?>.
Now we’ll move on to the content your visitors will see. You’ll need a header for every page, so you take your <H1> tag information and put it in another html file (example: “h1.html”) and move on to the next area, the navigation bar (example: “navigation.html”). Because one comes right after the other, you may call for both of them in one php command (like this: <?php include(“h1.html”); include(“navigation.html”); ?>). They aren’t in the same file because you may want to move the navigation later (for example, above the header or in the footer) or get rid of it on certain pages.
The next area will be the most unique part of the document, so it will be left as basic code. It will contain dividers, paragraphs, images, and other content that will differ from page to page. Finally, the footer (example: “foot.htm”) will be added using includes, and the last tags (<body> and <html>) will be closed.

There you go! All you have to do is build pages using those php include codes and you’ll be able to quickly make any changes you want later. Recently, having a “start.html” helped me quickly change my site to HTML5 (which required a Doctype change). If you need to add a new link in the navigation due to an additional page, you’ll only need to change one file (in this example, “navigation.html”) instead of editing every page on your site.