public final function render($file, $data = null) { $path = Dodo::app()->getConfig('app.path'); $view = Dodo::app()->getConfig('view.path'); if (in_array(substr($file, 0, 1), array('\\', '/'))) { $file = substr($file, 1); } if (substr($file, -4) != '.php') { $file .= '.php'; } $this->template = $path . '/' . $view . '/' . $file; if (!file_exists($this->template)) { throw new \Exception("Template file not found: {$this->template}."); } if (is_array($data)) { $this->vars = array_merge($this->vars, $data); } extract($this->vars); include $this->template; }
public function __construct() { $this->app = Dodo::app(); }