JApplicationHelper
From Joomla! Documentation
| This article or section is in the process of an expansion or major restructuring. You are welcome to assist in its construction by editing it as well. If this article or section has not been edited in several days, please remove this template. This article was last edited by Haelix (talk| contribs) 4 years ago. (Purge) |
JApplicationHelper is a class which provides helper functions for using JApplication. JApplicationHelper has functions to help you get client information, paths, and parse XML files into associative arrays.
Contents |
Defined in
/joomla/application/helper.php
Methods
In the following examples and text, "Site" refers to the front-end of Joomla and "Admin" refers to the Administrator/back-end area.
getClientInfo
- Gets information on a specific client id. This method will be useful in future versions when we start mapping applications in the database.
Function Definition
function &getClientInfo( $id = null , $byName = false )
Param: $id
- $id does not refer to a user id or number. It is an id/identifier of which client info we want to return. Calling this method without any params will return the following:
array(4) {
[0]=>
object(stdClass)#3 (3) {
["id"]=> int(0)
["name"]=> string(4) "site"
["path"]=> string(11) "<root directory>"
}
[1]=>
object(stdClass)#4 (3) {
["id"]=> int(1)
["name"]=> string(13) "administrator"
["path"]=> string(25) "<root directory>/administrator"
}
[2]=>
object(stdClass)#5 (3) {
["id"]=> int(2)
["name"]=> string(12) "installation"
["path"]=> string(24) "<root directory>/installation"
}
[3]=>
object(stdClass)#6 (3) {
["id"]=> int(3)
["name"]=> string(6) "xmlrpc"
["path"]=> string(18) "<root directory>/xmlrpc"
}
}
Param: $byName
Returns: $null
- mixed: $null, the object describing the client or false if not known
getPath
- This function returns a path to a specific file on the site.
Function Definition
function getPath( $varname , $user_option = null )
Param: $varname
- $varname tells Joomla where you want to look in this component
- Note: If no $user_option is specified, $user_option will default to "com_<component name>", "mod_<module name>", or <plugin name> depending on if you are using this method from a component, module, or plugin.
- front: returns the path to the component's front end (Site)
- Scope: Site Only
$result = "root / components / $user_option / <component name>.php "
- front: returns the path to the component's front end (Site)
- html:
- front_html:
- Scope: Site Only
- toolbar:
- Scope: Admin Only
root / administrator / components / $user_option / toolbar.<component name>.php
- toolbar:
- toolbar_html:
- Scope: Admin Only
root / administrator / components / $user_option / toolbar.<component name>.html.php
- toolbar_html:
- toolbar_default:
- toolbar_front:
- Scope: Site Only
root / includes / HTML_toolbar.php
- admin: returns the path to the component's main admin html file
- Scope: Admin Only
root / administrator / components / $user_option / admin.<component name>.php
- admin: returns the path to the component's main admin html file
- admin_html: returns the path to the component's main admin html file
- Scope: Admin Only
root / administrator / components / $user_option / admin.<component name>.html.php
- admin_html: returns the path to the component's main admin html file
- admin_functions:
- Scope: Admin Only
root / administrator / components / $user_option / <component name>.functions.php
- admin_functions:
- class:
- Scope: Site, then Admin ( if not found in Site, add /administrator after root )
root / components / $user_option / <component name>.class.php
- class:
- helper:
- Scope: Site, then Admin ( if not found in Site, add /administrator after root )
root / components / $user_option / <component name>.helper.php
- helper:
- com_xml:
- Scope: Site, then Admin ( if not found in Site, add /administrator after root )
root / components / $user_option / <component name>.xml
- com_xml:
- mod0_xml:
- Scope: Site, then Admin ( if not found in Site, add /administrator after root )
- Special Notes: Must specify $user_option = "mod_<module name>"
root / modules / $user_option / mod_<component name>.xml
- mod0_xml:
- mod1_xml:
- Scope: Admin Only
- Special Notes: Must specify $user_option = "mod_<module name>"
root / administrator / modules / $user_option / $user_option.xml
- mod1_xml:
- bot_xml: ( Legacy code )
- plg_xml:
- Scope: Site Only
- Special Notes: Must specify $user_option = "<plugin name>"
root / plugins / $user_option.xml
- menu_xml:
- Scope: Admin Only
- Special Notes: Must specify $user_option = "<plugin name>"
$result = "root / administrator / components / com_menus / $user_option / $user_option.xml "
- menu_xml:
Param: $user_option
- $user_option tells Joomla which other component you want to look for $varname in
- Example - from any component, front-end or back-end, the following code:
echo JApplicationHelper::getPath( 'admin' , 'com_contact' );
- will echo the following to screen:
root /administrator/components/com_contact/admin.contact.php
Returns: $result
- string: $result, the requested path or null if the file/path could not be found
parseXMLInstallFile
- Parses an XML Install File.
Function Definition
function parseXMLInstallFile( $path )
Param: $path
Method Returns
parseXMLLangMetaFile
- Parses an XML Language File.
Function Definition
function parseXMLLangMetaFile( $path )
Param: $path
Method Returns