JApplication/getMenu: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Returns the application JPathway object.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<now... |
No edit summary |
||
| Line 1: | Line 1: | ||
===Description=== | ===Description=== | ||
Return a reference to the application JPathway object. | |||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
| Line 9: | Line 9: | ||
===Syntax=== | ===Syntax=== | ||
<source lang="php">getMenu($name=null, $options=array())</source> | <source lang="php">& getMenu($name=null, $options=array())</source> | ||
{| class="wikitable" | {| class="wikitable" | ||
| Line 36: | Line 36: | ||
===Source Body=== | ===Source Body=== | ||
<source lang="php"> | <source lang="php"> | ||
function &getMenu($name = null, $options = array()) | |||
{ | { | ||
if (!isset($name)) { | if(!isset($name)) { | ||
$name = $this->_name; | $name = $this->_name; | ||
} | } | ||
jimport('joomla.application.menu'); | jimport( 'joomla.application.menu' ); | ||
$menu = &JMenu::getInstance($name, $options); | $menu =& JMenu::getInstance($name, $options); | ||
if (JError::isError($menu)) { | if (JError::isError($menu)) { | ||
return null; | $null = null; | ||
return $null; | |||
} | } | ||
return $menu; | return $menu; | ||
Revision as of 22:09, 22 March 2010
Description
Return a reference to the application JPathway object.
Template:Description:JApplication/getMenu
Syntax
& getMenu($name=null, $options=array())
| Parameter Name | Default Value | Description |
|---|---|---|
| $name | null | $options An optional associative array of configuration settings. |
| $options | array() |
Returns
object .
Defined in
libraries/joomla/application/application.php
Importing
jimport( 'joomla.application.application' );
Source Body
function &getMenu($name = null, $options = array())
{
if(!isset($name)) {
$name = $this->_name;
}
jimport( 'joomla.application.menu' );
$menu =& JMenu::getInstance($name, $options);
if (JError::isError($menu)) {
$null = null;
return $null;
}
return $menu;
}
[Edit See Also] Template:SeeAlso:JApplication/getMenu
Examples
<CodeExamplesForm />