I need a block where taxonomy terms are shown like a menu.
Something similar to http://thanhsiang.org/faqing/node/44 ( function taxonomy_node_get_terms is not available in DP7 ).

Comments

Anatsim’s picture

$vid = 4;
$output = ""; $ul_old = 0; $ul = 0;
$terms = taxonomy_get_tree($vid);
foreach ( $terms as $term ) {
  $ul =  $term->depth;
  if ($ul > $ul_old )  $output .= "<ul>";
  if ($ul < $ul_old )  $output .= "</ul>";
  if ($ul > 0 )  $output .= "<li>"; else  $output .= "<strong>";
  $output .= l($term->name, 'taxonomy/term/'. $term->tid, array('attributes'  => array('title' =>  $term->name)));
  if ($ul > 0 )  $output .= "</li>"; else  $output .= "</strong>";
  $ul_old=$ul; $output .= "\n";
}
echo $output;