Hi.
http://massassi.com/php/articles/template_engines/ and
http://www.phpclasses.org/browse/package/3146.html

I'm into a doubt.
Is it better using extract or not ?

PHP Code:
class Template {
      protected $file= '';
    public function __construct($fileName) {
        if (!is_file($fileName)) {
              throw new w_exceptions_FileException("The file ".$fileName." doesn't exist.");
        }
        $this->file= $file;
    }
    public function set($name, $value){
        $this->{$name}= ($value instanceof Template) ? $value->fetch() : $value;
    }
    public function fetch(){
        ob_start();                   
        include($this->file);               
        return ob_get_clean();              
    }
}
class Template_extract {
       protected $file= '';
    protected $vars= array();
    public function __construct($fileName) {
         if (!is_file($fileName)) {
              throw new w_exceptions_FileException("The file ".$fileName." doesn't exist.");
        }
        $this->file= $file;
    }
    public function set($name, $value){
        $this->vars[$name]= ($value instanceof Template_extract) ? $value->fetch() : $value;
    }
    public function fetch(){
        if(!empty($this->vars)){
            extract($this->vars); 
        } 
        ob_start();                   
        include($this->file);               
        return ob_get_clean();              
    }
    public function __destruct() {
      unset($this->vars);
       }
}

$tpl= new Template('tpl.htm');
$tpl->set('name','Whisher');
/*
tpl.htm look like
<p><?php echo $this->name ?></p>
*/


$tpl= new Template_extract('tpl.htm');
$tpl->set('name','Whisher');
/*
tpl.htm look like
<p><?php echo $name ?></p>
*/
Bye.