it loads the template file but it doesn't return the [Tags not found] error when loaded.
template.class
<?php
class tpl_engine{
public $themme;
public function tpl_engine($tpl){
if(file_exists($tpl)){
$this->themme = implode("",file($tpl));
}else{
exit("<script>alert('The $tpl file wasn\'t found!');</script>");
}
}
public function load($file){
ob_start();
include($file);
$disp = ob_get_contents();
ob_end_clean();
return $disp;
}
public function parse($tags){
if($tags > 0){
foreach($tags as $tag => $data){
$ctrl = (file_exists($data)) ? $this->load($data) : $data;
$this->themme = str_replace("{".$tag."}" , $ctrl , $this->themme);
}
}else{
exit("<script>alert('There\'s no tags for replacement!');</script>");
}
}
public function display(){
print $this->themme;
}
}
?>
index.php
<?php
require_once("lib/template.class");
$temp = new tpl_engine("themmes/default/template.tpl");
$temp->parse(array(
"title" => "titulo",
"header" => "themmes/default/header.tpl"
));
$temp->display();
?>
the error is in the parse() function if() statement , i have triyed like a hundred fuctions
to return the value but it just dont like me!
thanks by the way!
