| API | Package | Subpackage | Class | Reference | Last reviewed | Doc status |
|---|---|---|---|---|---|---|
Home |
Joomla.Framework |
Application |
JApplication |
JApplication |
Never | Work in Progress |
JApplication is the base class for a Joomla! application. It provides many basic API functions relating to the application itself.
An instance of this class, called $mainframe, is created using the existing database object and the option parameter that was passed in the request. Therefore you do not generally need to create a new instance of this object. If access to $mainframe is required within a function then it must be declared in a global statement at the top of the function so that the global variable is accessed.
In actual fact, $mainframe is an instance of either the JSite class or the JAdministrator class, both of which extend the JApplication class, depending on whether the Joomla! Front-end or Back-end is being executed, respectively. The class definition for JSite can be found in the includes/application.php file and the class definition for JAdministrator can be found in administrator/includes/application.php.
| Method | Description |
|---|---|
__construct | Constructor for the JApplication class. |
close | Exit the application. |
dispatch | Dispatch the application. |
enqueueMessage | Adds a message to the system message queue. |
execute | Executes the application. |
getCfg | Returns the value of a configuration variable from configuration.php. |
getClientId | Returns the client ID of the current running application. |
getMessageQueue | Retrieves the contents of the system message queue. |
getPathWay | Returns a reference to the JPathWay object. |
getTemplate | Returns the name of the current template. |
getUserState | Gets a user state. User state variables are stored with the session and can be used to maintain state between requests. |
getUserStateFromRequest | Gets the value of a user state variable from the request, using the existing state variable if it does not exist. |
isAdmin | Determines whether or not the application has been loaded from the admin interface. |
isSite | Determines whether or not the application has been loaded from the site interface. |
login | Login authentication function. |
logout | Logout authentication function. |
redirect | Enqueues a system message and redirects the browser to an alternative URL. |
render | Render the application. |
route | Route the application. |
registerEvent | Registers a handler to a particular event group. |
setConfiguration | Set a configuration value to the specified configuration file. |
setSession | Sets the user session, performing the necessary updates. |
setUserState | Sets the value of a user state variable. |
triggerEvent | Calls all handlers associated with an event group. |
The following methods are provided for backwards compatibility with Joomla! 1.0 and are scheduled to be removed in future versions. You should not use these methods to maintain compatibility with Joomla 1.5 or above.
| Method | Description |
|---|---|
addCustomHeadTag | Adds a custom HTML string to the head block of the current page being processed. Use JDocumentHTML::addCustomTag instead. |
addMetaTag | Adds a meta tag to the head block of the current page being processed. Use JDocument::setMetaData instead. |
appendMetaTag | Appends a value to an existing meta tag of the current page being processed. Use JDocument::setMetaData instead. |
appendPathWay | Appends a value on to the end of the custom pathway array. Use JPathWay::addItem instead. |
getBasePath | Returns the base path of the application. Use JURI::base() instead. |
getBlogCategoryCount | Returns the number of published blog categories. Use JApplicationHelper::getItemCount instead. |
getBlogSectionCount | Returns the number of published blog sections. Use JApplicationHelper::getItemCount instead. |
getContentItemLinkCount | Returns the number of content item links. Use JApplicationHelper::getItemCount instead. |
getCustomPathWay | Returns the custom pathway array. Use JPathWay::getNamePathWay instead. |
getGlobalBlogSectionCount | Returns the number of published global blog sections. Use JApplicationHelper::getItemCount instead. |
getHead | Returns current head block data for the current page being processed. JDocument::renderHead instead. |
getPath | Returns a stored path variable. JApplicationHelper::getPath instead. |
getStaticContentCount | Returns the number of published static content items. JApplicationHelper::getItemCount instead. |
prependMetaTag | Prepends text to an existing meta tag of the current page being processed. Use JDocument::setMetadata instead. |