/** * Include another template inside the main template (called within the template file). * Included template inherits parent templates variables and can optionally set its own * which live within the scope of that included template only. * * @param string $filename Filename for template to include - uses the same file paths as the parent * @param array $vars Optionally pass additional variables to the template * @return void * @author Ed Eliot **/ protected function inc_template($filename, $vars = array()) { $template = new HaploTemplate($filename, $this->filePaths); $template->vars = $this->vars; if (count($vars)) { foreach ($vars as $key => $value) { $template->set($key, $value); } } echo $template->render(); }