加载给定菜单的标题及其链接?

时间:2012-11-14 14:53:20

标签: php joomla

我已阅读此question,它会输出所有菜单及其属性。如何获取一个特定菜单的所有标题及其链接(我有三个)?

1 个答案:

答案 0 :(得分: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);

希望这有帮助