/** * Outputs the content by finding the correct template * and view file, if needed. */ public function getContent() { $tplDir = $this->isView ? $this->view->tpl : Config::$template; $config = array('base_url' => null, 'tpl_dir' => array(APP . 'template/' . $tplDir . '/'), 'cache_dir' => APP . 'tmp/', 'debug' => true, 'php_enabled' => true, 'tpl_ext' => 'php'); Tpl::configure($config); $tpl = new Tpl(); $tpl->assign('isView', $this->isView); $tpl->assign('title', Config::$data->title); if ($this->isView) { $vars = $this->view->getVars(); if (!empty($vars)) { foreach ($vars as $key => $value) { $tpl->assign($key, $value); } } $sep = DIRECTORY_SEPARATOR; $view = '..' . $sep . '..' . $sep . APP . 'view/' . $this->view->path; } else { $view = $this->view; if ($this->isJson === true) { echo $view; exit; } } try { File::get(APP . 'template/' . $tplDir . '/template.php'); if (class_exists('Template\\Model\\Template')) { $tpl_class = new Template\Model\Template(); $tpl->assign('template', $tpl_class); } } catch (Exception $e) { } $tpl->assign('view', $view); $tpl->draw('index'); }