Menu Index

<?php

function render_menu_tree($menu_name, $mlid = NULL, $menu = NULL) {

// Load the full menu array.

$menu = isset($menu) ? $menu : menu_tree_all_data($menu_name);

// For custom $menus and menus built all the way from the top-level we

// don't need to "create" the specific sub-menu and we need to get the title

// from the $menu_name since there is no "parent item" array.

// Create the specific menu if we have a mlid.

if (!empty($mlid)) {

// Load the parent menu item.

$item = menu_link_load($mlid);

$title = check_plain($item['title']);

// Narrow down the full menu to the specific sub-tree we need.

for ($p = 1; $p