Gracias, Wikipedia.
ShareCode
Permalink: http://www.treeweb.es/u/974/ 01/02/2011

ShareCode

1 /* Menu TreeWeb STORM */2 3 menu(ControllerPage::getNode(),11, true);4 5 function menu($node, $max_id = 1,$show_parent=false, $sel_id=0) {6  if ($node->getId() == $max_id) {7  $array = array(8  'level'=>1,9  'path'=>'/'.$node->getUrl()10  );11  } else {12  $array = menu($node->getParent(), $max_id, $show_parent, $node->getId());13  $array['level']++;14  $array['path'].='/'.$node->getUrl();15  }16 17  $children = $node->getChildren();18  if (count($children)) {19  echo '<div class="menu menu-'.$array['level'].'">';20  if ($node->getId() == $max_id && $show_parent)21  echo '<a class="menu-e'.$node->getId().$selected.'" href="'.$array['path'].'">'.$node->getTitle().'</a>';22 23  foreach($children as $n) {24  $selected = $n->getReference() == $sel_id ? ' selected' : '';25  echo '<a class="'.$selected.'" href="'.$array['path'].'/'.$n->getUrl().'">'.$n->getTitle().'</a>';26  }27  echo '</div>';28  }29 30  return $array;31 }
Enlace
El enlace para compartir es: