API15

JCategories/getInstance: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Returns a reference to a JCategories object <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JCategories/getInstance|Edit Descripton...
 
m preparing for archive only
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JCategories/getInstance|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JCategories/getInstance}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 59: Line 59:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JCategories/getInstance|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JCategories/getInstance}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=getInstance
  category=getInstance
  category=JCategories
  category=JCategories
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Latest revision as of 00:23, 25 March 2017

Description

Returns a reference to a JCategories object

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

static getInstance($extension, $options=array())
Parameter Name Default Value Description
$extension Name of the categories extension
$options array() An array of options

Returns

object

Defined in

libraries/joomla/application/categories.php

Importing

jimport( 'joomla.application.categories' );

Source Body

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

Code Examples