Example #1
0
 /**
  * Overridden to user FoundationVC_Config
  * @see Lvc_PageController::loadView()
  */
 protected function loadView($controllerViewName)
 {
     $view = Config::getControllerView($controllerViewName, $this->viewVars);
     if (is_null($view)) {
         throw new \Lvc_Exception('Unable to load controller view "' . $controllerViewName . '" for controller "' . $this->controllerName . '"');
     } else {
         $view->setController($this);
         $viewContents = $view->getOutput();
     }
     if ($this->useLayoutOverride) {
         $this->layout = $this->layoutOverride;
     }
     if (!empty($this->layout)) {
         // Use an explicit name for this data so we don't override some other variable...
         $this->layoutVars[Config::getLayoutContentVarName()] = $viewContents;
         $layoutView = Config::getLayoutView($this->layout, $this->layoutVars);
         if (is_null($layoutView)) {
             throw new \Lvc_Exception('Unable to load layout view "' . $this->layout . '" for controller "' . $this->controllerName . '"');
         } else {
             $layoutView->setController($this);
             $layoutView->output();
         }
     } else {
         echo $viewContents;
     }
     $this->hasLoadedView = true;
 }