The PHP Include Function

PHP is a popular general purpose scripting language that can be embedded into HTML. The PHP include function can be embedded in a web page to call an external file from the server or from a remote site.

This site is laid out with four divs: a header, nav, content, and footer. Since the information in the footer is most likely to change, we want to be able to update it by editing a single file. We could have included the footer information in the Dreamweaver template and, when we edited the template, every page that was generated from the template would have been updated. However, each updated page would then have to be published to the server, and that can be tedious with a large site. Instead of including the footer div in the template, we placed the information in an external file and embedded the following PHP include function in our Dreamweaver template:

<?php
include 'http://pittwebs.com/sothink/footer.html';
?>

You may have noticed that the pages in this site have an .html extension, yet pages with embedded PHP code normally require a .php extension. For a method that will allow you to embed PHP code in pages with .html extensions, see Embedding PHP In HTML Pages

.