Supports modularization - pages can have several standard components, such as headers, footers & sidebar menus, and each page can include customized variations.
Although there is only one copy of each included file, the #include statements are repeated many times, which could lead to errors (such as typographical errors) and inefficiencies (for example, if the name of an included file is changed, all the statements will have to be changed).
The general concept can be implemented in different languages. Here is an example in PHP.
<?php include "top.txt" ?>
<title>More PHP: Main page</title>
<!-- Custom style -->
<style type="text/css">
h1 {background: yellow; color:red;}
</style>
<?php include "nav.txt" ?>
<h1>Welcome to PHP demo</h1>
<p>This is the home page</p>
<?php include "bottom.txt" ?>
<?php include "top.txt" ?>
<title>More PHP: Second page</title>
<!-- Optional additional styles and other head elements would go here- -->
<?php include "nav.txt" ?>
<h1>Continued PHP demo</h1>
<p>This is the second page</p>
<?php include "bottom.txt" ?>
This file contains all of the common information for the top of each document.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<!-- Link to common stylesheet-->
<link rel="Stylesheet type="text/css" href="sharedstyle.css">
</head> <body> <hr /> <div class="nav"><a href="main.php">HOME PAGE</a> | <a href="second.php">SECOND PAGE</a></div> <hr /> <hr />
<hr /> <p>Foot Foot Foot Foot Foot </p> </body> </html>
Hood College Department of Computer Science: Course materials © 1997-2006 by Elizabeth Chang.