protected function loadTemplateContents(Template $template, $globals) { if ($this->benchmarkRendering) { $this->Benchmark->start('load-template-contents-' . $template->getName()); } $file = $template->getFile(); if (!($contents = $this->FileCache->getFileContents($file))) { $contents = file_get_contents($file); } // remove comments $contents = preg_replace("/{%\\s+\\/\\*.*\\*\\/\\s+%}/sU", '', $contents); // if (empty($contents)) // throw new TemplateEngineException("Template empty: " .$template->getName()); // $this->Logger->debug("Found contents:\n".$contents); $template->setContents($contents); if ($this->benchmarkRendering) { $this->Benchmark->end('load-template-contents-' . $template->getName()); } return $contents; }