Difference between revisions of "JApplication/getMenu"
From Joomla! Documentation
< API15:JApplication
(New page: ===Description===
Returns the application JPathway object.
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<now...) |
|||
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 17:09, 22 March 2010
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Return a reference to the application JPathway object.
Template:Description:JApplication/getMenu
Syntax[edit]
& getMenu($name=null, $options=array())
Parameter Name | Default Value | Description |
---|---|---|
$name | null | $options An optional associative array of configuration settings. |
$options | array() |
Returns[edit]
object .
Defined in[edit]
libraries/joomla/application/application.php
Importing[edit]
jimport( 'joomla.application.application' );
Source Body[edit]
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[edit]
<CodeExamplesForm />