diff --git a/flight/template/View.php b/flight/template/View.php index 4b2f968..2e53225 100644 --- a/flight/template/View.php +++ b/flight/template/View.php @@ -28,6 +28,13 @@ class View { */ protected $vars = array(); + /** + * Template file. + * + * @var string + */ + private $template; + /** * Constructor. * @@ -96,10 +103,10 @@ class View { * @throws \Exception If template not found */ public function render($file, $data = null) { - $template = $this->getTemplate($file); + $this->template = $this->getTemplate($file); - if (!file_exists($template)) { - throw new \Exception("Template file not found: $template."); + if (!file_exists($this->template)) { + throw new \Exception("Template file not found: {$this->template}."); } if (is_array($data)) { @@ -108,7 +115,7 @@ class View { extract($this->vars); - include $template; + include $this->template; } /**