public function view($slug) { $new = $this->_read('new', $slug); if (is_null($new)) { $this->router->show404(true); } $this->tpl->setVar('new', $new, false, true); $this->tpl->setVar('title', ucfirst($new->langTitle->{$this->tpl->lang}), false, true); if (!Validate::isEmpty($new->langDescr->{$this->tpl->lang})) { $this->tpl->setVar('desc', ucfirst($new->langDescr->{$this->tpl->lang}), false, true); } if (!Validate::isEmpty($new->langKeywords->{$this->tpl->lang})) { $this->tpl->setVar('keywords', $new->langKeywords->{$this->tpl->lang}, false, true); } $this->tpl->setFile('controllers' . DS . 'News' . DS . 'new.tpl.php'); }
public function view($slug) { $page = $this->_read('page', $slug); //check if exists if (is_null($page)) { $this->router->show404(true); } //define vars and template $this->tpl->setVar('page', $page, false, true); $this->tpl->setVar('title', ucfirst($page->langTitle->{$this->tpl->lang}), false, true); if (!Validate::isEmpty($page->langDescr->{$this->tpl->lang})) { $this->tpl->setVar('desc', ucfirst($page->langDescr->{$this->tpl->lang}), false, true); } if (!Validate::isEmpty($page->langKeywords->{$this->tpl->lang})) { $this->tpl->setVar('keywords', $page->langKeywords->{$this->tpl->lang}, false, true); } $this->tpl->setFile('controllers' . DS . 'Pages' . DS . 'page.tpl.php'); //run custom function for required pages (news, home, contact) $this->_defaultPage($slug); }