public function indexAction()
 {
     $app = \App\core\FrontController::getInstance();
     $data = $app->getPage();
     $type = $data['type'];
     switch ($type) {
         case 'static':
             $page_id = $data['page_id'];
             $page_id = intval($page_id);
             $select = array("where" => "`page_id` = {$page_id}");
             $table = new Cms_staticTable($select);
             $page = $table->getOneRow();
             $this->render('static', array('page' => $page));
             break;
         case 'category':
             $this->render('category');
             break;
         case 'entry':
             $this->render('entry');
             break;
         default:
             # code...
             break;
     }
 }
Exemplo n.º 2
0
 public function getPage($edit)
 {
     $edit = intval($edit);
     $select = array("where" => "`page_id` = {$edit}");
     $table = new Cms_staticTable($select);
     $data = $table->getOneRow();
     if (empty($data)) {
         throw new E404Exception();
     }
     $table = new CmsTable($select);
     $link = $table->getOneRow();
     $data['link'] = $link['link'];
     return $data;
 }
Exemplo n.º 3
0
 public static function addStaticPage($page_id, $title, $link, $content)
 {
     $cms = new \App\tables\CmsTable();
     $cms->fetchOne();
     $cms->page_id = $page_id;
     $cms->link = $link;
     $cms->type = 'static';
     $cms->save();
     $cms_static = new \App\tables\Cms_staticTable();
     $cms_static->page_id = $page_id;
     $cms_static->title = $title;
     $cms_static->content = $content;
     $cms_static->save();
 }