(This isn't the whole class, and it's still in progress, so if it looks odd, that's why.)
Code: Select all
public function __construct($templatePath, $stripWhitespace = false){
if($templatePath && file_exists($templatePath)){
ob_start(function($buffer){ return Mucklate::parseTemplate($buffer); });
include($templatePath);
}
}
public static function parseTemplate($buffer){
foreach(Mucklate::$varSet as $var){
$buffer = str_replace(Mucklate::$delimiter . $var["var"] . strrev(Mucklate::$delimiter), $var["value"], $buffer);
}
return $buffer;
}