public function ActionOne()
 {
     if (isset($_GET['id'])) {
         $articles = Articles::getOne($_GET['id']);
         $message = 'Статья с id ' . $_GET['id'] . ' не существует';
     } else {
         $message = 'Id не задан';
     }
     if (empty($articles)) {
         throw new E404Exception($message);
     }
     $view = new View();
     $view->article = $articles;
     $view->display('articles/one');
 }
Exemple #2
0
 public function run()
 {
     $request = Request::getInstance()->parseUrl();
     try {
         if (class_exists($request['ctrl'])) {
             $controller = new $request['ctrl']();
             $controller->callAction($request['act']);
         } else {
             throw new E404Exception('Controller ' . $request['ctrl'] . ' is not found');
         }
     } catch (E404Exception $e) {
         $view = new View();
         $view->error = $e->getMessage();
         $view->display('errors/404');
     }
 }
 public function actionIndex()
 {
     $view = new View();
     $view->display('index');
 }