7 - PHP:Introduction - Includes
INCLUDES ABSOLUTELY ROCK!!!
Lets say you have a Web site with 10 or so pages, and you want to update the navigation. You don't want the hassle of updating every single page. That's where php includes come in handy.
Your basic php includes will look like this:
< ?php include ( 'includes/navigation.php' ); ? >
That's it! What I typically do is design a page as usual, then begin breaking sections up into includes. To use this effectively:
Let's say we want to use the highlighted code on multiple pages:
<table>
<tr>
<td>
This table will be on every page.
</td>
</tr>
</table>
<table>
<tr>
<td>
This is some other content.
</td>
</tr>
</table>
We can use an include like this:
< ?php include ( 'includes/table.php' ); ? >
<table>
<tr>
<td>
This is some other content.
</td>
</tr>
</table>
Now if we change table.php later, it will change on every page automatically. It's just like using image tags, but instead of image files, you are including pieces of html. This can save you hours and hours.
Let's take some time to work with this concept.
(from askwebmaster.com)