(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'])) {
Courtesy : nicklewis.org
- guru's blog
- Login to post comments
![Drupal-6-Book-[Building Powerful and Robust Websites with Drupal 6].jpg](http://www.drupalranch.com/images/Drupal-6-Book-[Building%20Powerful%20and%20Robust%20Websites%20with%20Drupal%206].jpg)