Personally, I find it easiest to separate the template into two parts - header and footer.
You can do this in a number of different ways. The most common that I've seen has been to have a file for the top part of your template, and a file for the bottom part. Include those around the content you would like to see inside of the template.
For example, this would be in the header file:
Code:
<html>
<head>
<title>Page Title</title>
<body>
<h2>Page header</h2>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tr><td>
This would be in the footer file:
Code:
</td></tr>
</table>
</body>
</html>
Then your main PHP code would be as follows:
Code:
<?php
include ("header.php");
?>
Content that you want inside of the table
<?php
include ("footer.php");
?>
This would then output:
Code:
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h2>Page Header</h2>
<table border="1" cellspacing="0" cellpadding="0" width="100%">
<tr><td>Content that you would like inside the table</td></tr>
</table>
</body>
</html>
Hopefully this helps you out.