JFactory/getApplication: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 59: | Line 59: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getApplication | category=getApplication | ||
category=JFactory | category=JFactory | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:38, 25 March 2017
Description
Get a application object
<! removed transcluded page call, red link never existed >
Syntax
static getApplication($id=null, $config=array(), $prefix='J')
| Parameter Name | Default Value | Description |
|---|---|---|
| $id | null | $id A client identifier or name. |
| $config | array() | $config An optional associative array of configuration settings. |
| $prefix | 'J' |
Returns
object
Defined in
libraries/joomla/factory.php
Importing
jimport( 'joomla.factory' );
Source Body
public static function getApplication($id = null, $config = array(), $prefix='J')
{
if (!is_object(JFactory::$application))
{
jimport('joomla.application.application');
if (!$id) {
JError::raiseError(500, 'Application Instantiation Error');
}
JFactory::$application = JApplication::getInstance($id, $config, $prefix);
}
return JFactory::$application;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples