JCategories/getInstance
From Joomla! Documentation
< API15:JCategoriesRevision as of 08:51, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
Revision as of 08:51, 12 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Returns a reference to a JCategories object
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
static getInstance($extension, $options=array())
Parameter Name | Default Value | Description |
---|---|---|
$extension | Name of the categories extension | |
$options | array() | An array of options |
Returns[edit]
object
Defined in[edit]
libraries/joomla/application/categories.php
Importing[edit]
jimport( 'joomla.application.categories' );
Source Body[edit]
public static function getInstance($extension, $options = array())
{
if (isset(self::$instances[$extension]))
{
return self::$instances[$extension];
}
$classname = ucfirst(substr($extension,4)).'Categories';
if (!class_exists($classname))
{
$path = JPATH_SITE.DS.'components'.DS.$extension.DS.'helpers'.DS.'category.php';
if (is_file($path))
{
require_once $path;
} else {
return false;
}
}
self::$instances[$extension] = new $classname($options);
return self::$instances[$extension];
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />