Back to HtmlView class

Method _addPath

protected void
_addPath
(mixed $type, mixed $path)
Adds to the search path for templates and resources.
Parameters
  • string $type The type of path to add.
  • mixed $path The directory or stream, or an array of either, to search.
Returns
  • void
Since
  • 3.0
Class: HtmlView
Project: Joomla

Method _addPath - Source code

/**
 * Adds to the search path for templates and resources.
 *
 * @param   string  $type  The type of path to add.
 * @param   mixed   $path  The directory or stream, or an array of either, to search.
 *
 * @return  void
 *
 * @since   3.0
 */
protected function _addPath($type, $path)
{
    // Loop through the path directories
    foreach ((array) $path as $dir) {
        // Clean up the path
        $dir = Path::clean($dir);
        // Add trailing separators as needed
        if (substr($dir, -1) !== DIRECTORY_SEPARATOR) {
            // Directory
            $dir .= DIRECTORY_SEPARATOR;
        }
        // Add to the top of the search dirs
        array_unshift($this->_path[$type], $dir);
    }
}