Just want to generate a block that has all the terms in a vocabulary...how do I go about this? I didn't see how to do it in the Views module.

Comments

nevets’s picture

Do you want to vocabulary hardcoded (fixed) or based on something?

And do you just want the terms listed or linked to something?

dnguyen’s picture

Well I want the list of links to be based on what's currently in the vocabulary...so don't know what drupal variable would have those. And then I'd like each term to be a link to its taxonomy page. Similar to a tag-cloud.

nevets’s picture

When you say "Well I want the list of links to be based on what's currently in the vocabulary", do you mean the vocabulary for the current (single) node be dsplayed?

dnguyen’s picture

Nope, all of the existing terms of a given vocabulary. For example, if I have a vocabulary of photographers, on the front page, I'd like a listing of all the photographers currently in the vocabulary (i.e. the ones who have photos on my site).

nevets’s picture

<?php
$vid = 1;  // Set the vid to the vocabulary id of the vocabulary you wish to list the terms from
$items = array();

$terms = taxonomy_get_tree($vid);
foreach ( $terms as $term ) {
  $items[] = l($term->name, "taxonomy/term/$term->tid");
}

if ( count($items) ) {
  print theme('item_list', $items);
}
?>
dnguyen’s picture

Mucho gracias

Aleko’s picture

That's perfect but would it possible to indent sub-categories like that :

- Term1
- Term2
-- Sub-Term2.1
-- Sub-Term2.2
-Term3

etc... ???