I'm migrating a site from Drupal 5 to Drupal 6. The existing Drupal 5 site theme adds a class attribute value to the UL tag with an incremented number for every level of a navigation menu tree .. so the top level UL tag of a menu would have class="menu level-0", all its children UL tags would have class="menu level-1" .. their children UL tags would have class="menu level-2" and so on. It is done using the following phptemplate_menu_tree function in template.php:

function phptemplate_menu_tree($pid = 1) {
  static $level = 0;
    
  $class = 'list-' . $level++;
  $tree = menu_tree($pid);
  $level--;
  
  if ($tree) {
      return "\n<ul class=\"menu " . $class . "\">\n" . $tree . "\n</ul>\n";
  }
}

How would I do the same thing in Drupal 6? The problem is that in Drupal 6 the theme_menu_tree function works totally different. Unlike in Drupal 5, it now takes the whole tree (string) as a parameter (not just the $pid).

Any suggestions are greatly appreciated.

Thanks,
Jake