Web Programming with PHP

8 Web Page Template

The web page can be divided into four parts:

All different parts are put together by means of include() or require() (Including one File into another File).

Diagram of the web page template

header.inc

<!DOCTYPE html>
<html>
<head>
<title>miniFacebook</title>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="all" />
</head>
<body>
<div id="container">
<header>
<h1><a href="./register.php">miniFacebook</a></h1>
</header>

menu.inc

<ul id="main_menu">
<li><a href="register.php" title="Register new user">Register</a></li>
<li><a href="search.php" title="Users list">Search</a></li>
<li><a href="login.php" title="Login private area">Login</a></li>
</ul>

footer.inc

<footer>
<p>Copyright &copy; 2012 Sergio Luján Mora</p>
<p><a href="mailto:sergio.lujan%20at%20ua.es">Contact</a></p>
</footer>

</div>
</body>
</html>

index.php

<?php
  include "header.inc";
  include "menu.inc";

  // include main content
  
  include "footer.inc";
?>