Back to FileLayout class

Method render

public string
render
(mixed $displayData = array())
Method to render the layout.
Parameters
  • array $displayData Array of properties available for use inside the layout file to build the displayed output
Returns
  • string The necessary HTML to display the layout
Since
  • 3.0
Class: FileLayout
Project: Joomla

Method render - Source code

/**
 * Method to render the layout.
 *
 * @param   array  $displayData  Array of properties available for use inside the layout file to build the displayed output
 *
 * @return  string  The necessary HTML to display the layout
 *
 * @since   3.0
 */
public function render($displayData = array())
{
    $this->clearDebugMessages();
    // Inherit base output from parent class
    $layoutOutput = '';
    // Automatically merge any previously data set if $displayData is an array
    if (\is_array($displayData)) {
        $displayData = array_merge($this->data, $displayData);
    }
    // Check possible overrides, and build the full path to layout file
    $path = $this->getPath();
    if ($this->isDebugEnabled()) {
        echo '<pre>' . $this->renderDebugMessages() . '</pre>';
    }
    // Nothing to show
    if (empty($path)) {
        return $layoutOutput;
    }
    ob_start();
    include $path;
    $layoutOutput .= ob_get_contents();
    ob_end_clean();
    return $layoutOutput;
}