Even though the result prints correctly I still gets two error messages.
Warning: Undefined property: table in E:\wwwroot\sites\class.FastTemplate.php on line 375
Warning: Undefined property: ROWS in E:\wwwroot\sites\class.FastTemplate.php on line 301
And here's my source code of my small test page.
default.php
<?php
include('template.php');
PageStart();
for($i = 0; $i < 16; $i++) {
$result = pow(2, $i);
$template->assign(array(
"EXPONENT" => $i,
"RESULT" => $result
));
$template->parse("ROWS", ".row");
}
$template->parse("CONTENT", "table");
PageFinish("Exponent Overview");
?>
template.php
<?php
include "class.FastTemplate.php";
function PageStart()
{
global $template;
$template = new FastTemplate(".");
$template->define(array(
"table" => "table.tpl",
"main" => "main.tpl"
));
$template->define_dynamic("row", "table");
}
function PageFinish($title)
{
echo "<!-- PageFinish() -->";
global $template;
$template->assign("PAGE_TITLE", $title);
$template->parse("GLOBAL", "main");
$template->FastPrint();
}
?>
main.tpl
<head>
<title>Test site - {PAGE_TITLE}</title>
<body TEXT="white" BGCOLOR="black">
<h1>{PAGE_TITLE}</h1>
{CONTENT}
</body>
table.tpl
<table>
<tr>
<th>exponent</th>
<th>result of 2exponent</th>
</tr>
<!-- BEGIN DYNAMIC BLOCK: row -->
<tr>
<td>{EXPONENT}</td>
<td>{RESULT}</td>
</tr>
<!-- END DYNAMIC BLOCK: row -->
</table>
I'm using PHP4 - if anyone would wonder.