Situation at this moment
I'm using this function:
public function fetch($file){
$file = $this->options['template_dir'].(string)$file;
if(file_exists($file)){
ob_start();
if($this->options['extract']){
extract($this->vars);
}
include $file;
return ob_get_clean();
}else{
throw new Exception('De ('.$file.') template bestaat niet.');
}
}
Basically it just replaces <?php echo $name; ?>
from the tpl with the data of $tpl->name
.
The question
I would like to start using {$name}
instead of using <?php echo $name; ?>
in my TPL files. Can anyone point me in the right direction for replacing this with the data of $tpl->name
?
What I've tried
I tried to do it with a regex, trying to find the { and } and then replace it, but it will only output $name
as text.