/** * Parse template includes * * @return void */ protected function parseIncludes() { $matches = []; preg_match_all('/\\{\\{\\@include(.*?)\\}\\}/s', $this->template, $matches); if (isset($matches[0]) && isset($matches[0][0])) { foreach ($matches[0] as $key => $match) { $tmpl = trim($matches[1][$key]); if ($tmpl != $this->file) { $dir = $this->isFile() ? dirname($this->file) . DIRECTORY_SEPARATOR : null; $view = new Stream($dir . $tmpl); $this->template = str_replace($match, $view->render($this->data), $this->template); } } } }