src/Mvc/Controller.php
final public function render($action)
    {
        // Initialize view object if auto render is enable
        if (Configuration::read('mvc.view.auto_render') === true) {
            $this->setView($this->controller, $action);
        }
        // Initialize layout object if auto render is enable
        if (Configuration::read('mvc.layout.auto_render') === true) {
            // Get Layout default name from Configuration
            $layoutName = Configuration::read('mvc.layout.default');
            $this->setLayout($layoutName);
        }
        // Call initialize method in Controller if exists
        if (method_exists($this, 'initialize')) {
            $this->initialize();
        }
        // Launch action of controller
        ob_start();
        $actionResult = $this->$action();
        echo PHP_EOL;
        $bodyContent = ob_get_clean();
        // If Controller's Action return false, disable Layout and View
        if ($actionResult !== false) {
            if (isset($this->layout) && $this->layout->getAutoRender()) {
                // Get Layout and View if auto render of View enable
                $bodyContent .= $this->layout->render();
            } elseif (isset($this->view) && $this->view->getAutoRender()) {
                // Get View only
                $bodyContent .= $this->view->render();
            }
        }
        return $bodyContent;
    }
final public function render($action)
    {
        // Initialize view object if auto render is enable
        if (Configuration::read('mvc.view.auto_render') === true) {
            $this->setView($this->controller, $action);
        }
        // Initialize layout object if auto render is enable
        if (Configuration::read('mvc.layout.auto_render') === true) {
            // Get Layout default name from Configuration
            $layoutName = Configuration::read('mvc.layout.default');
            $this->setLayout($layoutName);
        }
        // Call initialize method in Controller if exists
        if (method_exists($this, 'initialize')) {
            $this->initialize();
        }
        // Launch action of controller
        ob_start();
        $actionResult = $this->$action();
        echo PHP_EOL;
        $bodyContent = ob_get_clean();
        // If Controller's Action return false, disable Layout and View
        if ($actionResult !== false) {
            if (isset($this->layout) && $this->layout->getAutoRender()) {
                // Get Layout and View if auto render of View enable
                $bodyContent .= $this->layout->render();
            } elseif (isset($this->view) && $this->view->getAutoRender()) {
                // Get View only
                $bodyContent .= $this->view->render();
            }
        }
        return $bodyContent;
    }
final public function render ( $ action ) { // Initialize view object if auto render is enable if ( Configuration :: read ( 'mvc.view.auto_render' ) === true ) { $ this -> setView ( $ this -> controller , $ action ) ; } // Initialize layout object if auto render is enable if ( Configuration :: read ( 'mvc.layout.auto_render' ) === true ) { // Get Layout default name from Configuration $ layoutName = Configuration :: read ( 'mvc.layout.default' ) ; $ this -> setLayout ( $ layoutName ) ; } // Call initialize method in Controller if exists if ( method_exists ( $ this , 'initialize' ) ) { $ this -> initialize ( ) ; } // Launch action of controller ob_start ( ) ; $ actionResult = $ this -> $ action ( ) ; echo PHP_EOL ; $ bodyContent = ob_get_clean ( ) ; // If Controller's Action return false, disable Layout and View if ( $ actionResult !== false ) { if ( isset ( $ this -> layout ) && $ this -> layout -> getAutoRender ( ) ) { // Get Layout and View if auto render of View enable $ bodyContent .= $ this -> layout -> render ( ) ; } elseif ( isset ( $ this -> view ) && $ this -> view -> getAutoRender ( ) ) { // Get View only $ bodyContent .= $ this -> view -> render ( ) ; } } return $ bodyContent ; }
Create the View and the Layout
Call initialize method if exist
Launch controller
Get Layout and View render if enable

@since   1.1
@param   string $action Name of Action
@return  string bodyContent of Controller, Layout and View
Create the View and the Layout Call initialize method if exist Launch controller Get Layout and View render if enable