-2

I have read this question which outputs all the menus and their attributes. How can I get all the titles and their links for one specific menu (I have three)?

Community
  • 1
  • 1
A Smith
  • 237
  • 5
  • 16

1 Answers1

1
// Get default menu - JMenu object
$name='blah'; //Name of your menu alias here
$menu = JFactory::getApplication()->getMenu($name);

// Get menu items - array with menu items
$items = $menu->getMenu();

// Look through the menu structure, once you understand it
// do a loop and find the link that you need.
var_dump($items);

Hope this helps

George Wilson
  • 5,595
  • 5
  • 29
  • 42
  • Thanks for your reply. I tried the above code but it gives the same output as the question I linked to in my initial post. I have made sure the menu alias/type is correct but the output is still given for all menus. – A Smith Nov 14 '12 at 18:26
  • OK try passing the $name into both instances of getMenu(); So like `$items = $menu->getMenu($name);` – George Wilson Nov 14 '12 at 19:50
  • Gives the same results unfortunately. – A Smith Nov 14 '12 at 23:47