I am trying to use phplib's templating functions to create a simple list for display on a web page. When I run the program the page is outputted correctly, however an error message "Undefined index: ABlock" is displayed at the top of the page. The output comes out fine except for this error message that gets inserted at the top of the page. Anybody else experience this problem?
The code is as follows:
HTML template:
<html>
<head>
<title>OXC Project Site - Project Listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
<!-- BEGIN AccessBlock -->
<li>{item}</li>
<!-- END AccessBlock -->
</body>
</html>
PHP code:
<?php
error_reporting(E_ALL);
include "/classes/phplib/template.inc";
$T = new Template("./");
$T->set_file('input_two', 'test.tpl');
$T->set_block('input_two', 'AccessBlock', 'ABlock');
$want_list=array(
0 => 'Baseball bat',
1 => 'Remote Control car',
2 => 'Wagon'
);
for ($i=0; $i<sizeof($want_list); $i++)
{
$T->set_var('item', $want_list[$i]);
$T->Parse('ABlock', 'AccessBlock', true);
}
$T->pparse('Output', 'input_two');
?>