Return to Snippet

Revision: 33989
at October 15, 2010 19:23 by jahmal


Initial Code
<?php
    $i = 0;
    $item = menu_get_item();
    $tree = menu_tree_page_data('primary-links');
    list($key, $curr) = each($tree);

    while ($curr) {
      // Terminate the loop when we find the current path in the active trail.
      if ($curr['link']['href'] == $item['href'] || $i++ > 2) {
        $tree = $curr['below'];
        $curr = FALSE;
      }
      else {
        // Add the link if it's in the active trail, then move to the link below.
        if ($curr['link']['in_active_trail']) {
          $tree = $curr['below'] ? $curr['below'] : array();
        }
        list($key, $curr) = each($tree);
      }
    }
		
		foreach ($tree AS $key => $val){
			if ($val['link']['in_active_trail']){
				$tree_int = $val['below'];
				break;
			}
		}
		
    $menuhtml = theme_menu_tree(menu_tree_output($tree_int));
    print $menuhtml;
?>

Initial URL

                                

Initial Description

                                

Initial Title
Get Drupal menu down from current page

Initial Tags
drupal

Initial Language
PHP