Actions

Category

Difference between revisions of "Application"

From Joomla! Documentation

m (Broke category loop)
(Merged into Application (CMS))
Line 1: Line 1:
In Joomla! there are three possible applications: '''Administrator''', '''Site''', and '''Installation'''. Each application extends the abstract base class '''JApplication''' with objects '''JAdministrator''', '''JSite''', and '''JInstallation''' respectively.<br /><br />
+
{{:Application}}
  
  JApplication
+
[[Category:Framework]]
    |
+
    |---> JAdministrator
+
    |
+
    |---> JSite
+
    |
+
    |---> JInstallation
+
<br />
+
The Joomla! 1.5 framework uses the global variable '''$mainframe''' to reference the [[Application]] object. '''$mainframe''' is an object of type '''JAdministrator''', '''JSite''' or '''JInstallation''' depending on the application currently running.
+
 
+
This provides an easy way for extensions to reference global application properties and methods without having to be concerned with which Application object is currently being referenced. When a component is operating in the backend, '''$mainframe''' will be pointing to the '''JAdministrator''' Application object. When a component is operating in the frontend, '''$mainframe''' will be pointing to the '''JSite''' Application object. During installation, '''$mainframe''' will be pointing to the '''JInstallation''' Application object.
+
 
+
'''JAdministrator''', <strong>JSite</strong> and '''JInstallation''' are not documented or found on api.joomla.org because they are extended classes of '''JApplication''' and not the framework.  The '''JApplication''' class is documented on api.joomla.org since it is part of the core.  The '''JSite''' and '''JAdministrator''' classes extend '''JApplication''' with methods and properties specific to their frontend or backend requirements.
+
<br /><br /><br />
+
'''NOTE:'''
+
The use of the global variable '''$mainframe''' has been deprecated as of 1.5 and has been removed in 1.6.<br /><br />
+
<br />
+
<source lang='php'>
+
    global $mainframe;
+
</source>
+
<br />
+
Instead, use:
+
<br /><br />
+
<source lang='php'>
+
    $app = JFactory::getApplication();
+
</source>
+
<br />
+
Please note that the variable '''''$app''''' is totally arbitrary. You could use '''''$mainframe''''' if it reduces the number of changes required throughout your code, for example:
+
<br /><br />
+
<source lang='php'>
+
    $mainframe = JFactory::getApplication();
+
</source>
+
 
+
[[Category:Framework]] [[Category:Glossary]]
+

Revision as of 15:43, 12 July 2011


<translate> Application may refer to:

  • Application (Package), a collection of PHP classes from the Joomla! Framework
  • JApplication, a PHP class from the Joomla! Framework

You may also browse Application for articles and tutorials about this subject.</translate>

<translate>== See also == === Joomla! CMS ===</translate> {{:Application (CMS)/<translate> en</translate>}} <translate>=== Help screens ===

Pages in category ‘Application’

The following 7 pages are in this category, out of 7 total.