There can be so much to gain by having this - namely reusability.
- Code: Select all
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="content-type" content="text/html"/>
<link rel="stylesheet" media="screen" href="screen.css"/>
<base href="http://www.mysite.com"/>
</head>
<body>
<include src="header.html"/>
<include src="nav.html"/>
<include src="sidebar.html"/>
<include src="/cms/articleEngine.php" param="viewType=2"/>
<include src="footer.html"/>
</body>
</html>
header.html
----------------
<header>
<img src="/images/logo.png" alt="Logo"/>
</header>
nav.html
------------
<nav>
<ul>
<li><a href="home.html">Home</a></li>
<li><a href="contact.html">Contact</a></li>
<li><a href="about.html">About</a></li>
</ul>
sidebar.html
----------------
<aside>
<div id="register">
<include src="registerForm.html"/>
</div>
<div id="ad">
<include src="googleAd.html"/>
</div>
</aside>
footer.html
---------------
<footer>
<p>Copyright © MySite.com 2011. All rights reserved</p>
</footer>
/cms/ArticleEngine.php
-------------------------------
ArticleEngine($_GET['param'], $numArticles=4);
By default, files are relative from the base.