To make the template system work, the most important thing to remember is that any PHP variable you use in the template must be defined prior to calling the template. Take the template bwlow, which I use in my sites:
<html>
<head>
<title>
$pagetitle</title>
<link rel="stylesheet" type="text/css" href="../css/main.css">
<script language="JavaScript" src="../scripts/global.js" type="text/javascript"></script>
</head>
<body bgcolor=#470848 topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" text=#D5D3D3>
<table border=0 cellpadding=0 cellspacing=0 width="100%" height=100%>
<tr height=90>
<td width=146 align=center><img src="../images/bigbullet1.jpg" width=91 height=90></td>
<td align=center><img src="../images/logo.gif" width="456" height="39"></td>
</tr>
<tr><td>
<table background="../images/menucenter.jpg" cellpadding=0 cellspacing=0 border=0 height=100%>
<tr><td class=bg><img src="../images/menutop.jpg"></td></tr>
$pagemenu
<tr><td height=99% valign=bottom><img src="../images/menubottom.jpg"></td></tr>
</table>
</td>
<td valign=top>
<center><img src="../images/line2.jpg" width=355 height=10><br>
$pageheading</center><br>
$pagecontent
</td></tr>
</table>
</body>
</html>
The PHP variable, shown in bold face, must be defined before calling the template. Below is a typical page I would use with this template.
<?php
require "../php/global.inc";
require "../php/about-menu.inc";
$pagetitle = "About My Site";
$pageheading="<h3>Please choose a area you would like to learn about.</h3>";
$pagecontent = "";
$pagemenu="";
for ($i=0; $i < count($menunames); $i++) {
eval("\$pagemenu .= \"".gettemplate("menu")."\";");
}
eval("echo \"".gettemplate("main")."\";");
?>
The require statements import function unigue to my site. The point here is to show that I had to make sure that all the vairable I use in the template are defined. I also found that it works best if you give any variables you use in the templete to an empty string at the beginning of the script. It will take of some headaches later(trust me).
I hope this helps. The example I have shown works on my system. If you have problems getting it working for your self, email me and I would be happy to help. My address is defiantapp_s@omnitelcom.com
Happy Programming
Defiant
P.S. Sorry for the delay on posting a reply, been pritty busy. I will try to keep a closer eye in the future.