function phptemplate_menu_tree($pid = 1) { if ($tree = phptemplate_menu_tree_improved($pid)) { return "\n
\n"; } } function phptemplate_menu_tree_improved($pid = 1) { $menu = menu_get_menu(); $output = ''; if (isset($menu['visible'][$pid]) && $menu['visible'][$pid]['children']) { $num_children = count($menu['visible'][$pid]['children']); for ($i=0; $i < $num_children; ++$i) { $mid = $menu['visible'][$pid]['children'][$i]; $type = isset($menu['visible'][$mid]['type']) ? $menu['visible'][$mid]['type'] : NULL; $children = isset($menu['visible'][$mid]['children']) ? $menu['visible'][$mid]['children'] : NULL; $extraclass = $i == 0 ? 'first' : ($i == $num_children-1 ? 'last' : ''); $output .= theme('menu_item', $mid, menu_in_active_trail($mid) || ($type & MENU_EXPANDED) ? theme('menu_tree', $mid) : '', count($children) == 0, $extraclass); } } return $output; } function phptemplate_menu_item($mid, $children = '', $leaf = TRUE, $extraclass = '') { $item = menu_get_item($mid); // get current menu item // decide whether to add the active class to this menu item if((($link_item['path']=='