add_content("content", $page); $template->add_content("AJAXMODE", ); */ return implode("LOL", preg_split("//", $buffer)); } function includefile($matches) { global $page; switch ($matches[1]) { case "content": return addfile($page); break; default: return addfile($matches[1].".php"); break; } } ob_start(); $output = compile(); die(preg_replace_callback("//", "includefile", $output)); function compile() { ob_start(); include "template.php"; return ob_get_clean(); } function addfile($file) { ob_start(); $flag = true; include $file; return preg_replace_callback("//", "includefile", ob_get_clean()); } ?>