<?php
require ("../../phplibex.inc.php");
$tpl = new templateparser("C:/apachefriends/xampp/htdocs/phplibex/samples/template/");
$testmessage = "Hello World";
$tpl->tpl_register_var( $testmessage, "testmessage" );
$tpl->tpl_register_var( "I`m a test header", "header" );
$tpl->tpl_register_var( "Test-Title", "titel" );
$tpl->tpl_register_var( "V1.00", "version" );
$tpl->tpl_register_var( "Template", "surename" );
$tpl->tpl_register_var( "Parser", "lastname" );
$myarray1[] = "Array 1 Field 0";
$myarray1[] = "Array 1 Field 1";
$myarray1[] = "Array 1 Field 2";
$myarray1[] = "Array 1 Field 3";
$myarray1[] = "Array 1 Field 4";
$myarray1[] = "Array 1 Field 5";
$myarray1[] = "Array 1 Field 6";
$myarray1[] = "Array 1 Field 7";
$tpl->tpl_register_var( $myarray1, "testarray1" );
$myarray2[] = "Array 2 Field 0";
$myarray2[] = "Array 2 Field 1";
$myarray2[] = "Array 2 Field 2";
$myarray2[] = "Array 2 Field 3";
$myarray2[] = "Array 2 Field 4";
$myarray2[] = "Array 2 Field 5";
$myarray2[] = "Array 2 Field 6";
$myarray2[] = "Array 2 Field 7";
$tpl->tpl_register_var( $myarray2, "testarray2" );
$tpl->tpl_parse_all("test.tpl");
$tpl->tpl_display_tpl( );
$errors = $tpl->tpl_get_errorlist( );
for ( $loop=0; $loop <= sizeof($errors); $loop++ )
echo "<b>".$errors[$loop]."</b><br>";
$tpl->tpl_unset_array( "testarray1" );
$tpl->tpl_unset_array( "testarray2" );
?>
<html>
<head>
<META NAME="Author" CONTENT="Kai Klenovsek">
<META NAME="Date" CONTENT="22.12.2004">
<META NAME="Subject" CONTENT="Template-Test">
<title> {titel} </title>
</head>
<body>
<center><h2> {header} </h2></center>
<p>
Version: <b>{version}</b><br>
Surename: <b>{surename}</b><br>
Lastname: <b>{lastname}</b> <br>
Testmessage: <b>{testmessage}</b><br>
<include filename="include_file.tpl">
<br>
Single array value: <b>{testarray1.0}</b>
<br><br><br>
<table border="1">
<loop><tr><td>{testarray2}</td><td>{testarray1}</td></tr></loop>
</table>
</p>
</body>
</html>