How to Update Multiple Web Pages Using PHP

PHP can be used to create common content in multiple pages in much the same way as the SSI Virtual Include.


  1. Server-side is safer than client-side (it doesn't rely on any browser settings).
  2. Updates are very fast and easy.


  1. Slight performance overhead at the server end (every PHP page needs to be processed by the server before it is served to the user).
  2. You usually need to use a special extension for web pages, e.g. .php.
  3. The server must support PHP (most servers do).

Create a plain text document for the common content and save it in a folder which is accessible from your whole website. You may want to make a special folder for this type of file, e.g. /includes/. Your file might look like this (we'll call this file copyright.html):

<!-- Begin Copyright -->
<span style='color:blue;'>© Copyright MyName 2004</span>
<!-- End Copyright -->

In each page, add the following code:

<?php require("/includes/copyright.html"); ?>