ET (Easy Template) is very easy to learn.
  1. Basics:
  2. 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:

    {title}

    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).

  3. Blocks:
  4. ET (Easy Template) manage any kinds of blocks: loops, contitionals, ... Here is a sample loop block:

    The template:

    <!--{ foreach($mylist as $myitem): }-->
    { $myitem } &nbsp;
    <!--{ 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.

  5. Include:
  6. 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.