0

I have a JMenu object (from standard mod_menu in Joomla 2.5) but I don't know how to retrieve its title, does anyone know how to do this? I retrieved my active menu in this way:

$menu = $app->getMenu();

It was easy to get every menu item or module param but it seems impossible to get the menu title. Thanks in advance.

BitRider
  • 255
  • 2
  • 11

1 Answers1

0

I haven't tested this but have a feeling it might work:

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule( 'mod_menu' );
echo $module->title;

If there is more than one instance of the module, then you can be more specific by declaring for example the ID of the module:

$module = JModuleHelper::getModule( 'mod_menu', '88' ); //change 88 to the ID that applies for you

Hope this helps

Lodder
  • 19,758
  • 10
  • 59
  • 100
  • Almost there! I have not only one menu, so when I load all the menus, with the code you provided I can only retrieve the active menu title. The second option you suggested (the one with the ID) doesn't work for me, don't know why, maybe because of the platform version (11.4). Is there a way to get the specific mod_menu instance by the menutype parameter? – BitRider Apr 22 '13 at 15:04
  • 2
    @BitRider - Check this out for more details, might come in handy: http://docs.joomla.org/JModuleHelper/getModule – Lodder Apr 22 '13 at 15:35
  • Thanks again @Lodder but it seems there is no way to do what I want. The overrided version of the getModule function take as a parameter the title of the module that is exactly what I would it to return. I'll just do it another way. – BitRider Apr 22 '13 at 15:50