I am trying to learn FastTemplate in PHP4. When I run my following script, The header row comes in nicely but the data rows give me this statement:
"Fatal error: Cannot instantiate non-existent class: fasttemplate in ... on line xxx"
Could someone take a quick at my code to see where my problem is? I have been to the various classes on line and feel I am fairly close but I can't seem to fix the error for the above Fatal error.
My template is called con_champs_rows.tpl and looks like this:
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>Year</title>
</head>
<body>
<table border="0" cellpadding="0" width="665" height="25">
<tr>
<td align="center" width="50" ><font face="Arial" size="2">{YEAR}</font></td>
<td align="left" width="200"><font face="Arial" size="2"> {TEAM}</font></td>
<td align="center" width="70"><font face="Arial" size="2">{RECORD}</font></td>
<td align="center" width="100"><font face="Arial" size="2">{COCHAMPS}</font></td>
<td align="left" width="245"><font face="Arial" size="2"> {NOTES}</font></td>
</tr>
</table>
</body>
I created it in Frontpage.
My code looks like this:
<?php
include ("con_champs_header.htm");
include ("con_champs_rows.tpl");
$tpl = new FastTemplate("../../../include_files");
$tpl->define(array(
"row_tpl" => "con_champs_rows.tpl"
));
mysql_connect("localhost", "password", "")
or die("Could not connect to database.");
mysql_select_db("football") or
die("Cannot select database");
$GetData = mysql_query ("select year, teamid, record, co_champ, note
from cchamps
where confid = 113,
year = $Year
teamid = $Team
record = $Record
co_champ = $Cochamps
note = $Notes");
if ($GetDataArray = mysql_fetch_array($GetData)) {
do {
$Year = $GetDataArray["year"];
$Team = $GetDataArray["teamid"];
$Record = $GetDataArray["record"];
$Cochamps = $GetDataArray["co_champ"];
$Notes = $GetDataArray["note"];
$tpl->assign("YEAR", $Year);
$tpl->assign("TEAM", $Team);
$tpl->assign("RECORD", $Record);
$tpl->assign("COCHAMPS", $Cochamps);
$tpl->assign("NOTES", $Notes);
$tpl->parse(result, "row_tpl");
}
while ($GetDataArray = mysql_fetch_array($GetData));
$tpl->parse("header_tpl");
$tpl->FastPrint(result);
}
else
{
print ("Error obtaining data.");
}
?>
The other template I am using will just print the header row.
Any help would be appreciated.
David