Simple example

Template file: authors.tpl

<html>
 <head><title>{PAGE_TITLE}</title></head>
 <body>
  <table>
   <caption>Authors</caption>
   <thead>
    <tr><th>Name</th><th>Email</th></tr>
   </thead>
   <tfoot>
    <tr><td colspan="2">{NUM_AUTHORS}</td></tr>
   </tfoot>
   <tbody>
<!-- BEGIN authorline -->
    <tr><td>{AUTHOR_NAME}</td><td>{AUTHOR_EMAIL}</td></tr>
<!-- END authorline -->
   </tbody>
  </table>
 </body>
</html>

PHP code: authors.php

<?php
//we want to display this author list
$authors = array(
    
'Christian Weiske'  => 'cweiske@php.net',
    
'Bjoern Schotte'     => 'schotte@mayflower.de'
);

require_once 
'HTML/Template/PHPLIB.php';
//create template object
$t =& new HTML_Template_PHPLIB(dirname(__FILE__), 'keep');
//load file
$t->setFile('authors''authors.tpl');
//set block
$t->setBlock('authors''authorline''authorline_ref');

//set some variables
$t->setVar('NUM_AUTHORS'count($authors));
$t->setVar('PAGE_TITLE''Code authors as of ' date('Y-m-d'));

//display the authors
foreach ($authors as $name => $email) {
    
$t->setVar('AUTHOR_NAME'$name);
    
$t->setVar('AUTHOR_EMAIL'$email);
    
$t->parse('authorline_ref''authorline'true);
}

//finish and echo
echo $t->finish($t->parse('OUT''authors'));
?>