ET (Easy Template) replace php variables by its values. For example, if you set a "title" variable in your php code, when
Easy Template find {title} in the template, it is replaced by the title value.
Example: the template contain:
The php code is:
<?php
require_once("lib/tpl.php");
$tpl = & new Template($tpl_file);
$tpl->set('title', '<b>ET (Easy Template)</b>');
echo $tpl->fetch();
?>
When the php page is called, the template is parsed. The result is: ET (Easy Template).
ET (Easy Template) manage any kinds of blocks: loops, contitionals, ... Here is a sample loop block:
The template:
foreach($mylist as $myitem):
}-->
$myitem
}
endforeach;
}-->The php code:
<?php
require_once("lib/tpl.php");
$tpl = & new Template($tpl_file);
$tpl->set('mylist', array('It', 'is', 'an', 'array'));
echo $tpl->fetch();
?>
The result is: It is an array.
With ET (Easy Template), it's very easy to use sub-templates, e.g. templates included in a main template. To include a sub-template, just use {include mysubtemplate.html} in your template. In this page, the menu is a subtemplate.