I'm searching a simple made template engine that allows me to insert vars, loops, and blocks (of other tpl) into my html file using a simple markup. I was trying to make it by me, but after I wroten this i didn't know more...
Code: Select all
class template {
private $__file;
function __construct($f){
$this->__file = file_get_contents($f);
}
function set($t) {
foreach($t as $tag => $valore) {
$this->__file = str_replace("{".$tag."}", $valore, $this->__file);
}
}
function display() {
return $this->__file;
}
function __destruct() {
unset($this->__file);
}
}thanks a lot!!
[ sorry for my english... im italian]