JApplicationHelper/getComponentName: Difference between revisions
From Joomla! Documentation
m clean up |
m preparing for archive only |
||
| Line 53: | Line 53: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getComponentName | category=getComponentName | ||
category=JApplicationHelper | category=JApplicationHelper | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 00:17, 25 March 2017
Description
Return the name of the request component [main component]
<! removed transcluded page call, red link never existed >
Syntax
static getComponentName($default=NULL)
| Parameter Name | Default Value | Description |
|---|---|---|
| $default | NULL | $default The default option |
Returns
string Option
Defined in
libraries/joomla/application/helper.php
Importing
jimport( 'joomla.application.helper' );
Source Body
public static function getComponentName($default = NULL)
{
static $option;
if ($option) {
return $option;
}
$option = strtolower(JRequest::getCmd('option'));
if (empty($option)) {
$option = $default;
}
JRequest::setVar('option', $option);
return $option;
}
<! removed transcluded page call, red link never existed >
Examples
Code Examples