Back to HtmlView class

Method setLayout

public string
setLayout
(mixed $layout)
Sets the layout name to use
Parameters
  • string $layout The layout name or a string in format <template>:<layout file>
Returns
  • string Previous value.
Since
  • 3.0
Class: HtmlView
Project: Joomla

Method setLayout - Source code

/**
 * Sets the layout name to use
 *
 * @param   string  $layout  The layout name or a string in format <template>:<layout file>
 *
 * @return  string  Previous value.
 *
 * @since   3.0
 */
public function setLayout($layout)
{
    $previous = $this->_layout;
    if (strpos($layout, ':') === false) {
        $this->_layout = $layout;
    } else {
        // Convert parameter to array based on :
        $temp = explode(':', $layout);
        $this->_layout = $temp[1];
        // Set layout template
        $this->_layoutTemplate = $temp[0];
    }
    return $previous;
}