Skip to content

Commit

Permalink
Removing conditional calling of View::_render() as a static method.
Browse files Browse the repository at this point in the history
Updating doc blocks.
  • Loading branch information
markstory committed Aug 20, 2009
1 parent 3b95b4c commit add1ded
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions cake/libs/view/view.php
Expand Up @@ -326,7 +326,7 @@ function __construct(&$controller, $register = true) {
* @param string $name Name of template file in the/app/views/elements/ folder
* @param array $params Array of data to be made available to the for rendered
* view (i.e. the Element)
* Special params:
* Special params:
* cache - enable caching for this element accepts boolean or strtotime compatible string.
* Can also be an array
* if an array,'time' is used to specify duration of cache. 'key' can be used to
Expand Down Expand Up @@ -413,11 +413,7 @@ function render($action = null, $layout = null, $file = null) {
}

if ($action !== false && $viewFileName = $this->_getViewFileName($action)) {
if (substr($viewFileName, -3) === 'ctp' || substr($viewFileName, -5) === 'thtml') {
$out = View::_render($viewFileName, $this->viewVars);
} else {
$out = $this->_render($viewFileName, $this->viewVars);
}
$out = $this->_render($viewFileName, $this->viewVars);
}

if ($layout === null) {
Expand Down Expand Up @@ -449,10 +445,11 @@ function render($action = null, $layout = null, $file = null) {
/**
* Renders a layout. Returns output from _render(). Returns false on error.
* Several variables are created for use in layout.
* title_for_layout - contains page title
* content_for_layout - contains rendered view file
* scripts_for_layout - contains scripts added to header
* cakeDebug - if debug is on, cake debug information is added.
*
* - `title_for_layout` - contains page title
* - `content_for_layout` - contains rendered view file
* - `scripts_for_layout` - contains scripts added to header
* - `cakeDebug` - if debug is on, cake debug information is added.
*
* @param string $content_for_layout Content to render in a view, wrapped by the surrounding layout.
* @return mixed Rendered output, or false on error
Expand Down Expand Up @@ -491,12 +488,7 @@ function renderLayout($content_for_layout, $layout = null) {
}

$this->_triggerHelpers('beforeLayout');

if (substr($layoutFileName, -3) === 'ctp' || substr($layoutFileName, -5) === 'thtml') {
$this->output = View::_render($layoutFileName, $data_for_layout, $loadHelpers, true);
} else {
$this->output = $this->_render($layoutFileName, $data_for_layout, $loadHelpers);
}
$this->output = $this->_render($layoutFileName, $data_for_layout, $loadHelpers);

if ($this->output === false) {
$this->output = $this->_render($layoutFileName, $data_for_layout);
Expand Down

0 comments on commit add1ded

Please sign in to comment.