Actions

Difference between revisions of "Application (CMS)"

From Joomla! Documentation

(Split off CMS content from Application)
 
(Merged from Category:Application)
Line 1: Line 1:
 +
<onlyinclude>
 
Joomla! consists of several [[Application]]s:
 
Joomla! consists of several [[Application]]s:
 
* [[Site (Application)|Site]], also known as the ''Front-end''.
 
* [[Site (Application)|Site]], also known as the ''Front-end''.
Line 4: Line 5:
 
* [[Installer (Application)|Installer]] is an application that helps you to install and configure Joomla on your web site. Follow the next steps at [http://docs.joomla.org/Installer Installer].  This application should be deleted as soon as installation is completed.
 
* [[Installer (Application)|Installer]] is an application that helps you to install and configure Joomla on your web site. Follow the next steps at [http://docs.joomla.org/Installer Installer].  This application should be deleted as soon as installation is completed.
 
* [[XML-RPC (Application)|XML-RPC]], known as eXtensible Markup Language Remote Procedure Call, is a method of sharing messages between client and server.  Note that from version 1.6 onwards, the XML-RPC application is no longer included in the Joomla distribution.
 
* [[XML-RPC (Application)|XML-RPC]], known as eXtensible Markup Language Remote Procedure Call, is a method of sharing messages between client and server.  Note that from version 1.6 onwards, the XML-RPC application is no longer included in the Joomla distribution.
 +
</onlyinclude>
 +
The main applications are '''Administrator''', '''Site''', and '''Installation'''. Each application extends the abstract base class '''JApplication''' with objects '''JAdministrator''', '''JSite''', and '''JInstallation''' respectively.
 +
 +
<pre>
 +
  JApplication
 +
    |
 +
    |---> JAdministrator
 +
    |
 +
    |---> JSite
 +
    |
 +
    |---> JInstallation
 +
</pre>
 +
 +
The Joomla! 1.5 framework uses the global variable <code>$mainframe</code> to reference the [[Application]] object. <code>$mainframe</code> 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, <code>$mainframe</code> will be pointing to the '''JAdministrator''' Application object. When a component is operating in the frontend, <code>$mainframe</code> will be pointing to the '''JSite''' Application object. During installation, <code>$mainframe</code> will be pointing to the '''JInstallation''' Application object.
 +
 +
'''JAdministrator''', '''JSite''' 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.
 +
 +
'''NOTE:'''
 +
The use of the global variable <code>$mainframe</code> has been deprecated as of 1.5 and has been removed in 1.6.
 +
 +
<source lang="php">
 +
global $mainframe;
 +
</source>
 +
 +
Instead, use:
 +
 +
<source lang="php">
 +
$app = JFactory::getApplication();
 +
</source>
 +
 +
Please note that the variable <code>$app</code> is totally arbitrary. You could use <code>$mainframe</code> if it reduces the number of changes required throughout your code, for example:
 +
 +
<source lang="php">
 +
$mainframe = JFactory::getApplication();
 +
</source>
 +
 
<noinclude>[[Category:Application| CMS]][[Category:Glossary]]</noinclude>
 
<noinclude>[[Category:Application| CMS]][[Category:Glossary]]</noinclude>

Revision as of 15:42, 12 July 2011

Joomla! consists of several Applications:

  • Site, also known as the Front-end.
  • Administrator, also known as the Back-end. It is here that you can make your major customisations for your site or front-end. You can set up how your template looks or you can add new extensions such as components, languages, modules, plugins and templates from the Joomla! Extension Directory (JED).
  • Installer is an application that helps you to install and configure Joomla on your web site. Follow the next steps at Installer. This application should be deleted as soon as installation is completed.
  • XML-RPC, known as eXtensible Markup Language Remote Procedure Call, is a method of sharing messages between client and server. Note that from version 1.6 onwards, the XML-RPC application is no longer included in the Joomla distribution.

The main applications are Administrator, Site, and Installation. Each application extends the abstract base class JApplication with objects JAdministrator, JSite, and JInstallation respectively.

  JApplication
    |
    |---> JAdministrator
    |
    |---> JSite
    |
    |---> JInstallation

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, JSite 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.

NOTE: The use of the global variable $mainframe has been deprecated as of 1.5 and has been removed in 1.6.

global $mainframe;

Instead, use:

$app = JFactory::getApplication();

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:

$mainframe = JFactory::getApplication();