$data = {include "header.tpl"}{include "footer.tpl"}; private function get_tpl_includes($data){ $this->includes = preg_match_all('/{include \"[^}]\"*}/', $data, $this->includes); foreach($this->includes as $include){ $tpl_file = $this->dir . str_replace($this->dir, "", $include[0]); $html_include = file_get_contents($tpl_file) or die("tp3"); //Get the content of the included html $pattern = '{include "' . $tpl_file . '"}'; //Create a pattern to replace in the html $this->html = str_ireplace($pattern, "", $this->html); //Replace the file include pattern with html } }
этот код прав, потому что он не производит никакого вывода, хотя нижние и заголовочные файлы не пустые.