У меня есть этот код:
class template
{
public $template,$prefix,$replace;
function __construct($template, $prefix)
{
$this->prefix = $prefix;
$this->template = $template;
}
public function SetValue($name, $replace)
{
$this->replace["#".$name."#"] = $replace;
}
public function Tempclude($found)
{
$file = "styles/main/".$found[1].'.html';
if(!file_exists($file))
exit("the template '" . $found[1] . "' wasn't found.");
return file_get_contents($file);
}
public function finish($stream = "normal")
{
if($stream == "folder")
$code = file_get_contents("../styles/main/".$this->template.".html");
else
$code = file_get_contents("styles/main/".$this->template.".html");
$code = preg_replace_callback("@<pb:include=\"(.*)\">@iuU", array($this, 'Tempclude'), $code);
if(is_array($this->replace))
$code = str_replace(array_keys($this->replace), $this->replace, $code);
$code = str_replace("\r\n", "", $code);
$code = str_replace(" ", "", $code);
echo $code;
}
}
Если я наберу в шаблоне какой-нибудь простой текст, страница станет белой без чего-либо внутри.
В чем проблема?