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/sothink6/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 so that the PHP interpreter will parse the page.
If your site uses an Apache server, you can have PHP code on a page with an .html extension if you use an Apache handler. If your server has cPanel, select "Apache Handlers". Under Extension(s) add .html and under Handler add application/x-httpd-php. Click the Add button and you're done. If you don't have cPanel, add the following line to an .htaccess file:
AddHandler application/x-httpd-php .html
One word of caution: if you have a lot of HTML files on your server that don't contain PHP code, the files will still be parsed, and it may slow things down.
