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;
     }
 }
Пример #2
0
 public function __construct()
 {
     $app = \App\core\FrontController::getInstance();
     $this->_params = $app->getParams();
     $_controller = $app->getController();
     $this->_controller = str_replace('Controller', '', $_controller);
     $_action = $app->getAction();
     $this->_action = str_replace('Action', '', $_action);
 }
Пример #3
0
<?php

namespace App;

session_start();
error_reporting(E_ALL);
require 'config.php';
require SITE_PATH . 'vendor' . DS . 'autoload.php';
require SITE_PATH . 'core' . DS . 'Connecting_DB.php';
try {
    // Запускаем маршрутизатор
    $app = \App\core\FrontController::getInstance();
    $app->route();
    // Отображаем страничку 404
} catch (\App\core\E404Exception $e) {
    // echo $e->getMessage();
    $rc = new \ReflectionClass('\\App\\controllers\\E404Controller');
    $controller = $rc->newInstance();
    $method = $rc->getMethod('indexAction');
    $method->invoke($controller);
}
Пример #4
0
 public function __construct()
 {
     $rc = \App\core\FrontController::getInstance();
     $this->_params = $rc->getParams();
 }
Пример #5
0
 function init()
 {
     parent::init();
     $this->layout = false;
 }
Пример #6
0
 function init()
 {
     parent::init();
     session_start();
 }