The function adds one or more view paths to the controller's stack, in LIFO order.

  • mixed $path - The directory (string) or list of directories (array) to add
  • return \JControllerLegacy - This object to support chaining
public function addViewPath($path)
return $this->addPath('view', $path);

The addPath()

The function adds to the search path for templates and resources.

  • string $type - The path type (e.g. 'model', 'view')
  • mixed $path - The directory string or stream array to search
  • return \JControllerLegacy - A \JControllerLegacy object to support chaining
protected function addPath($type, $path)
if (!isset($this->paths[$type]))
$this->paths[$type] = array();

// Loop through the path directories
foreach ((array) $path as $dir)
// No surrounding spaces allowed!
$dir = rtrim(\JPath::check($dir), '/') . '/';

// Add to the top of the search dirs
array_unshift($this->paths[$type], $dir);

return $this;


Base Controller
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive