Print a particular vocabulary's terms associated with node

  • http://drupal.org/node/460136
  • <?php
    /**
    * Prints an unordered list of the terms (as links) that are
    * associated to the currently displayed node.
    */
    if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
       
    $node = node_load(arg(1));
       
    $vid = 2; // = 1 !!!
       
    $terms = taxonomy_node_get_terms_by_vocabulary($node, $vid);
        if (
    $terms) {
    print
    '<ul>';
                    foreach (
    $terms as $term) {
                    print
    '<li>'.l($term->name, 'taxonomy/term/'.$term->tid).'</li>';

              }
    print
    '</ul>';
        }
    }
    ?>

Klassifikation