public function renderLayout() { //echo "class: " . get_class($this) . ", layout: " . $this->sLayoutTemplate; FlexiLogger::debug(__METHOD__, $this->sLayoutTemplate); foreach ($this->aViewVars as $sKey => $mValue) { $this->oView->addVar($sKey, $mValue); } //putting up messages $this->oView->addVar("#message", FlexiConfig::$aMessage); //echo "layout: " . $this->sLayoutTemplate; if (!$this->beforeRender()) { return; } //echo "layout: " . $this->sLayoutTemplate; if (!empty($this->sLayoutTemplate)) { //echo "has layout"; $this->oView->addVar("header", $this->oView->render("header", null, $this->sModulePath)); $this->oView->addVar("notice", $this->oView->render("notice", null, $this->sModulePath)); //manually called in //$this->oView->addVar("body", $this->renderView()); $this->oView->addVar("footer", $this->oView->render("footer", null, $this->sModulePath)); //echo "ppp"; if (FlexiConfig::$sFramework == "modx2") { //FlexiController::appendOutput("is render layout: " . $this->sLayoutTemplate); FlexiController::appendOutput($this->oView->render($this->sLayoutTemplate, null, $this->sModulePath)); } else { echo $this->oView->render($this->sLayoutTemplate, null, $this->sModulePath); } } else { //echo __METHOD__.": no layout, viewname: " . $this->sRenderViewName; if (FlexiConfig::$sFramework == "modx2") { //FlexiController::appendOutput("is render non-layout"); FlexiController::appendOutput($this->oView->getVar($this->sRenderViewName)); } else { echo $this->oView->getVar($this->sRenderViewName); } } $this->afterRender(); $this->unsetSession("#messages"); }
<?php $oFlexi = FlexiController::getInstance(); //based on ?mod=xxxx $oControl = FlexiController::getCurrentController(); if (FlexiConfig::$sFramework == "modx2") { FlexiController::appendOutput($oControl->getView()->getVar($viewname)); } else { echo $oControl->getView()->getVar($viewname); }
<?php $oFlexi = FlexiController::getInstance(); //based on ?mod=xxxx $oControl = FlexiController::getCurrentController(); if (FlexiConfig::$sFramework == "modx2") { FlexiController::appendOutput($oControl->renderView($viewname)); return FlexiController::$sOutput; } else { echo $oControl->renderView($viewname); }
public function run($asModule, $asMethod, $abRenderLayout = true) { FlexiLogger::debug(__METHOD__, "module: " . $asModule . ", method: " . $asMethod . ", renderlayout:" . ($abRenderLayout ? "yes" : "no")); //echo (__METHOD__. ":module: " . $asModule . ", method: " . $asMethod . ", renderlayout:" . ($abRenderLayout ? "yes" : "no")); $oView = new FlexiView(); $aResult = $this->_run($asModule, $asMethod, $oView); //FlexiLogger::debug(__METHOD__, "after _run"); if ($abRenderLayout) { $aResult["control"]->renderLayout(); } else { //echo "no layout"; FlexiController::appendOutput($oView->getVar("body")); } return $aResult["return"]; }