public function __construct() { $this->request = MLight::app()->request; $config = MLight::app()->config; if (isset($config->layout)) { $this->setLayout($config->layout); } $this->_path = isset($config->viewPath) ? $config->viewPath : APP . 'Views/'; $this->title = isset($config->title) ? $config->title : $this->title; $this->init(); }
private function initController() { $controller = ucfirst(MLight::app()->request->getControllerName()); $action = MLight::app()->request->getActionName() . 'Action'; if (!file_exists(APP . 'Controller/' . $controller . '.php')) { throw new NotExistsException('Контроллер ' . $controller . ' не существует'); } else { $controller = 'Application\\Controller\\' . $controller; $controller = new $controller(); } if (!method_exists($controller, $action)) { throw new NotExistsException("Контроллер " . $controller->name() . " не имеет действия {$action}"); } else { $controller->{$action}(); } }