示例#1
0
 /**
  *
  * @throws \Exception
  */
 public function actionView($sef = null)
 {
     $params = \Uc::app()->url->getParams();
     if (!empty($params['sef'])) {
         $sef = $params['sef'];
     }
     if (empty($sef)) {
         throw new \Exception('Сторінка не знайдена', 404);
     }
     $postTable = \Ub\Site\Pages\Table::instance();
     $select = $postTable->select();
     $select->sefIs($sef);
     $select->publishedIs(\Ub\Site\Pages\Model::STATUS_PUBLISHED);
     $page = $postTable->fetchOne($select);
     if (empty($page)) {
         throw new \Exception('Сторінка не знайдена', 404);
     }
     $this->setSeoMetaFromModel($page);
     \Uc::app()->theme->setValue('site_page_id', $page->pk());
     if (!empty($page->template)) {
         $template = $page->template;
     } else {
         $template = 'view';
     }
     $this->render($template, array('model' => $page));
 }
示例#2
0
 protected function getConnectedTable()
 {
     return \Ub\Site\Pages\Table::instance();
 }