Actions

API16

Difference between revisions of "JCategories/getInstance"

From Joomla! Documentation

< API16:JCategories
(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 (removing red link to edit, no existant pages)
 
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 62: Line 62:
  
 
<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===
Line 77: Line 77:
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API16]]

Latest revision as of 21:55, 12 May 2013

Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

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];
        }
        $parts = explode('.',$extension);
        $component = $parts[0];
        $section = (count($parts)>1)?$parts[1]:'';
        $classname = ucfirst(substr($component,4)).ucfirst($section).'Categories';
        if (!class_exists($classname))
        {
                $path = JPATH_SITE.DS.'components'.DS.$component.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

<CodeExamplesForm />