There are a number of templating systems you can look into (e.g. "Smarty").
I usually just define a few functions in an include file, include it into a given page, then call those functions as needed.
page.php:
<?php
function head($title)
{
$title = htmlspecialchars($title);
$html = <<<EOD
<html>
<head>
<title>".htmlspecialchars($title)."</title>
<link rel="stylesheet" type="text/css" href="/styles/style.css">
</head>
<body>
<ul id="nav"><!-- nav links here --></ul>
<div id="main">
EOD;
return $html;
}
function foot()
{
$html = <<<EOD
</div>
<div id="foot"><!-- footer content here --></div>
</body></html>
EOD;
return $html;
}
Sample_page.php:
<?php
require_once 'page.php';
echo head("Sample Page");
// Here you generate the content unique to this page
echo foot();
?>