Simple way to show a taxonomy tree view?

Events happening in the community are now at Drupal community events on www.drupal.org.
Screenack's picture

I believe I'm over-thinking this.

I wish to show a hierarchical or tree view of a vocabulary. it's a two-tiered taxonomy.

How would you do this?

TIA,
Kyle

Comments

If I was doing this in a

afreeman's picture

If I was doing this in a custom module I'd do something like this, or maybe set tab depth via css based on the $term->depth. shrug

      $items = array();
      $tree = taxonomy_get_tree($vocabulary->vid);
      if ($tree && (count($tree) > 0)) {
        $options = array();
        foreach ($tree as $term) {
          $items[$term->tid] = str_repeat('-', $term->depth) . $term->name;
        }
      }
      print theme('item_list', $items);

Views does taxonomy term lists, I'm not sure how well it's display handles hierarchical terms.

taxonomy menu

daveparrish's picture

Hi Kyle,

It sounds like you might be looking for something like taxonomy menu. When the terms are in a menu you can put them anywhere on the site you want using menu block.

Much thanks!

Screenack's picture

Thanks all! Taxonomy menu nails the problem. Since all it's really doing is rendering an unordered list, which is better, semantically, than what I was originally thinking and simple to roll out.

http://drupal.org/node/223675

****Me and Drupal :)****
Clickbank IPN - Sell online or create a membership site with the largest affiliate network!
Review Critical - One of my sites

North Carolina

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: