public final function render() { $this->lf = $this->layout !== null ? get::mvc_file('layout', $this->layout) : false; if ($this->lf === false && $this->layout != 'default') { $this->lf = get::mvc_file('layout', 'default'); } $this->vf = $this->view !== null ? get::mvc_file('view', $this->view) : false; if ($this->lf === false) { throw new Exception('Unable to find layout: ' . $this->layout); } if ($this->vf === false) { throw new Exception('Unable to find view: ' . $this->view); } if (isset($this->params) && is_array($this->params) && is::assoc_array($this->params)) { extract($this->params); } $this->helpers = get::helpers('template'); extract($this->helpers); ob_start(); require $this->vf; $munla_view_data = ob_get_contents(); ob_end_clean(); if (!isset($page_title)) { $page_title = config::TITLE_DEFAULT; } if (!isset($page_class)) { $page_class = preg_replace('[^a-zA-Z0-9-_]', '', str_replace('/', '-', $this->view)); } require $this->lf; }
public function __toString() { if (isset($this->params) && is_array($this->params) && is::assoc_array($this->params)) { extract($this->params); } $this->helpers = get::helpers('template'); if (count($this->helpers) > 0) { extract($this->helpers); } ob_start(); require $this->file; $data = ob_get_contents(); ob_end_clean(); return $data; }