(Tutorial) Drupal Trick : Returning A Themed Menu Tree With Nothing More Than The System Path

Tutorial : Drupal Trick : Returning A Themed Menu Tree With Nothing More Than The System Path

I remember something a long time teacher said, "Nick, if you make a suit out of a gorrilla, the arms are too long." I forgot why that was relevent to the topic of theming menu trees.

Moving on, here's a nice little function I wrote to return a themed menu tree by path.

<?php
// will return all menu items under "administration".
print theme('menu_tree_by_path','admin');

// will return links to all node submission forms
print theme('menu_tree_by_path','node/add');

// return the correct menu array by path
function menu_get_mid_by_path($path) {
// oddly, menu_get_item accepts a path, but returns the parent id.
$menu = menu_get_item(null, $path);
if (isset($menu['children'])) {

Read more..

Courtesy : nicklewis.org