Server Side Includes (SSI) are used to create functions, headers,
footers, or elements that will be reused on multiple pages.
The tutorial menu on the left of this page is in a SSI include. It appears on every page and to update it we only have to change the one include file and all pages are automatically updated. Imaging we added a new page and had to add a link to every single tutorial page? NUTS!
Server Side Includes
You can insert the content of one file into another file before the server
executes it, with the require() function. The require() function is used to
create functions, headers, footers, or elements that will be reused on multiple
pages.
This can save the developer a considerable amount 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.
Example
The following example includes a header that should be used on all pages:
<html>
<body>
<?php require("header.htm"); ?>
<p>
Some text
</p>
<p>
Some text
</p>
</body>
</html>
|