public function run($action, $actionName, $route) { try { $this->_view->addTemplateDir("resources/templates/{$route}"); $template = "{$actionName}.tpl"; if (strcmp($this->_view->templateExists($template), '1') !== 0) { $errorController = new ErrorController(); $errorController->error404("テンプレートファイルが存在しません:{$template}"); } $this->{$action}(); $this->_view->display($template); } catch (Exception $e) { $errorController = new ErrorController(); $errorController->error500($e); } }