An Introduction to PHP

Server-side includes

A server side include is a file that is included within the current document on the server. This can save the developer a considerable amout of time. If all of the pages on your site have a similar header, you can include a single file containing the header into your pages. When the header needs updating, you only update the one page, which is included in all of the pages that use the header. As many include files may be used as required.

In PHP, server side includes are achieved using the require statement. The following example includes a banner that contains a logo and set of links for the pages.

<title>Server Side Include</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<?php require("banner.html"); ?>
This page contains a banner that may be incuded in any
of the PHP files used on this site.

You might also like...


About the author

Gez Lemon United Kingdom

I'm available for contract work. Please visit Juicify for details.

Interested in writing for us? Find out more.


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Perl - The only language that looks the same before and after RSA encryption.” - Keith Bostic