/** * Runs the requested action and outputs its results. * * Typically called by the FrontController. * * @param string $actionName the action name to run. * @param array $actionParams the parameters to pass to the action. * @return void * @throws Lvc_Exception * @author Anthony Bush **/ public function runAction($actionName, &$actionParams = array()) { $this->actionName = $actionName; $func = Lvc_Config::getActionFunctionName($actionName); if (method_exists($this, $func)) { $this->beforeAction(); // Call the action if (Lvc_Config::getSendActionParamsAsArray()) { $this->{$func}($actionParams); } else { call_user_func_array(array($this, $func), $actionParams); } // Load the view if (!$this->hasLoadedView && $this->loadDefaultView) { $this->loadView($this->controllerName . '/' . $actionName); } $this->afterAction(); return true; } else { throw new Lvc_Exception('No action `' . $actionName . '`. Write the `' . $func . '` method'); } }