Base Database Model

The method adds a directory where Joomla should search for models. You may either pass a string or an array of directories.

  • mixed $path - A path or array[sting] of paths to search.
  • string $prefix - A prefix for models.
  • return array - An array with directory elements. If prefix is equal to '', all directories are returned.
public static function addIncludePath($path = '', $prefix = '')
{
static $paths;

if (!isset($paths))
{
$paths = array();
}

if (!isset($paths[$prefix]))
{
$paths[$prefix] = array();
}

if (!isset($paths['']))
{
$paths[''] = array();
}

if (!empty($path))
{
jimport('joomla.filesystem.path');

foreach ((array) $path as $includePath)
{
if (!in_array($includePath, $paths[$prefix]))
{
array_unshift($paths[$prefix], \JPath::clean($includePath));
}

if (!in_array($includePath, $paths['']))
{
array_unshift($paths[''], \JPath::clean($includePath));
}
}
}

return $paths[$prefix];
}