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)?
Asked
Active
Viewed 79 times
-2
-
2I believe it's all over the documentation. – Peon Nov 14 '12 at 14:55
-
I've checked this page amongst others as well (http://docs.joomla.org/JMenu/1.6). Unless I'm missing something, could you tell me where then? – A Smith Nov 14 '12 at 15:05
-
If its so obvious do please let me know as I still can't find anything. – A Smith Nov 14 '12 at 17:08
1 Answers
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
-