<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Templateze Overview</title>
<style>
<!--
h1
{
margin:0cm;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:10.0pt;
font-family:"Times New Roman";
color:windowtext;
font-weight:bold;}
-->
</style>
</head>
<body>
<p align="center"><b><i><font size="4" color="#000080">Templateze Overview</font></i></b></p>
<p>A very simple and quick template engine that allows php developers to
separate html from php code.</p>
<p>----------------------<br><b>Example 1</b><br>----------------------<br>
<font color="#000080">Quick variable
replacement and template display</font></p>
<p> include("templateze.php");<br>
$tpl = new templateze("./example.html");<br>
$tpl->set("var1|$var1");<br>
$tpl->set("var2|$var2");<br>
$tpl->set("var3|$var3");<br>
echo $tpl->display();<br>
<p>----------------------<br><b>Example 2</b><br>----------------------<br>
<font color="#000080">Change replacement tags, variable
replacement and template display</font></p>
<p> include("templateze.php");<br>
$tpl = new templateze("./example.html");<br> $tpl->tagchange("%");<br>
$tpl->set("var1|$var1");<br>
echo $tpl->display();
<p>----------------------<br><b>Example 3</b><br>----------------------<br>
<font color="#000080">Loop replacement</font></p>
<p> include("templateze.php");<br>
$tpl = new templateze("./example.html");<br>
$table_rows = array();<br>
$table_rows[] = array( 'id' => '1',<br>
'first_name' => 'John',<br>
'surname' => 'Smith'<br>
);<br>
$table_rows[] = array( 'id' => '2',<br>
'first_name' => 'Bill',<br>
'surname' => 'Jones'<br>
);<br>
$table_rows[] = array( 'id' => '3',<br>
'first_name' => 'Tom',<br>
'surname' => 'Robins'<br>
);<br>
<br>
$tpl->setloop("table_rows");<br>
echo $tpl->display();
<p>----------------------<br><b>Example 4</b><br>----------------------<br>
<font color="#000080">Grab the contents of a second file and insert it into the
template.</font></p>
<p> include("templateze.php");<br> $tpl = new templateze("./example.html");<br>
$tpl->tplblock("header|./template_head.html");<br>
echo $tpl->display();
<p> <hr>
<p>When working with templates most of the time there are three types of basic
needs</p>
<ol>
<li>Variable Replacement</li>
<li>Loops for building dynamic tables</li>
<li>Blocks for including code from different templates</li>
</ol>
<p>Templateze makes use of the above using very simple functions.</p>
<p> $tpl->set(KEY|$VAR)<br> $tpl->setloop(LOOPNAME)<br> $tpl->tplblock(KEY|TEMPLATE)</p>
<p align="center"><b><font color="#000080">Templateze Demo Explained</font></b></p>
<p align="left"><font color="#000080"><b>$tpl = new templateze("./example.html");</b></font><br>
This will initiate the class and load the template into memory.
A relative or full server path can be used to locate the template.</p>
<font color="#000080"><b>$tpl->set("var1|$var1");</b></font>
<br>Sets both the key and variable seperated by the
deliminator | and then changes the key within the template.</p>
<p><font color="#000080"><b>$tpl->tagchange("%");<br></b></font>Changes the tags
to search for within the template. Default tag is set to ~ IE: ~KEY~</p>
<p><font color="#000080"><b>$tpl->setloop("table_rows");<br></b></font>This
parses the defined loop called table_rows using a previously defined array of
the same name.</p>
<p><font color="#000080"><b>$tpl->tplblock("header|./template_head.html");<br></b></font>This
sets the key (header) and replaces that with the contents of template_head.html</p>
<p><font color="#000080"><b>echo $tpl->display();<br></b></font>Returns and displays the
complete template.</p>
<p> </p>
</body>
</html>