====== getInstance ====== {#JAPI Joomla.Framework Application JMenu::getInstance #} Returns a reference to a client's global JMenu object, only creating it if it doesn't already exist. JMenu is implemented as a Singleton object, that is only one instance of this object exists per client ('site', 'administrator', 'installation'.) Do not use the new operator to "create" a new menu; the JMenu instance provides you with all the mainmenu modules. ===== Syntax ===== JMenu &getInstance (**$client**, **$options** = array()) | **$client** | string | A string identifying the client (see [[JApplicationHelper-getClientInfo|JApplicationHelper::getClientInfo]]) | | **$options** | array | Optional. An associative array of options (reserved for future use) | ===== Examples ===== jimport( 'joomla.application.menu' ); // get the Singleton instance $menu = &JMenu::getInstance('site'); // get the active menu $active = &$menu->getActive(); echo 'Active: ', $active->name; // get the default menu $active = &$menu->getDefault(); echo 'Default: ', $active->name; Might produce: Active: FAQ Default: Home ---- ~~DISCUSSION~~