Back to HtmlDocument class

Method _loadTemplate

protected string
_loadTemplate
(mixed $directory, mixed $filename)
Load a template file
Parameters
  • string $directory The name of the template
  • string $filename The actual filename
Returns
  • string The contents of the template
Since
  • 1.7.0
Class: HtmlDocument
Project: Joomla

Method _loadTemplate - Source code

/**
 * Load a template file
 *
 * @param   string  $directory  The name of the template
 * @param   string  $filename   The actual filename
 *
 * @return  string  The contents of the template
 *
 * @since   1.7.0
 */
protected function _loadTemplate($directory, $filename)
{
    $contents = '';
    // Check to see if we have a valid template file
    if (is_file($directory . '/' . $filename)) {
        // Store the file path
        $this->_file = $directory . '/' . $filename;
        // Get the file content
        ob_start();
        require $directory . '/' . $filename;
        $contents = ob_get_contents();
        ob_end_clean();
    }
    return $contents;
}