Include files
This tutorial shows how to use the include() function.
The include() function can be used to call an external file from your server or even a different server.
Syntax
The general syntax for a basic include is as follows
<?php include("otherfile.txt"); ?>
This includes a file called otherfile.txt from the same directory on your server.
You can also use it like this
<?php include("http//www.myothersite/otherfile.txt"); ?>
This means you can share the same file on more than one site .
Advantages
Well the advantages are obvious if you are site is growing. Imagine you have a site with 50 pages and you have designed a nice
navigation area but you have forgotten a download link. This would require 50 changes to your site but using an template with an
include file you would change the include file content and all the other pages would be updated .
|