Return to Snippet

Revision: 20220
at November 10, 2009 02:28 by level09


Initial Code
function render_terms($node,$vocabid,$title=null,$divclass=null) {

$terms = taxonomy_node_get_terms_by_vocabulary($node, $vocabid );
if ($terms) {

$output = '<div class="field field-item'. ' '.$divclass .'"><div class="field-label-inline-first">' .$title .' </div> ' ;
$term_links = array();
foreach ($terms as $term) {
$term_links[] = l($term->name, taxonomy_term_path($term), array('attributes' => array('rel' => 'tag', 'title' => strip_tags($term->description)))) ;
$output .= implode(", ", $term_links);
}
}
$output .='</div>';
return ($output);
}

Initial URL

                                

Initial Description

                                

Initial Title
Render Taxonomy Terms based on Vocab ID

Initial Tags
drupal

Initial Language
PHP