1. 通过menu_tree_all_data来读取相应的菜单项
primary-links来读取基本菜单。
也可以读取自定义的菜单。
2. 通过$m[‘below’]来得到是不是有子菜单
<?php
$i = 0;
$menuItems = menu_tree_all_data(‘primary-links’);
foreach($menuItems as $key => $m):
?>
<?php
$href = drupal_get_path_alias($m[‘link’][‘link_path’]);
$newhref = $href == ‘/‘ ? $href : ‘/‘ . $href;
$isactive = is_active_menu($newhref);
if ($isactive) {
} else {
}
if ($isactive) {
$cursubmenu = $m[‘below’];
$cursubmenunode = $m;
}
if ($m[‘below’]) {
?>
.
<?php
foreach($m[‘below’] as $k => $v) {
$a = $dir . drupal_get_path_alias($v[‘link’][‘link_path’]);
echo “{$v[‘link’][‘title’]}
“;
“;
}
?>
<?php
}
$i++;
?>
<?php endforeach; ?>