I have several categories that are applied to different node types, however there are only two that I ever want to print out when the theme says <?php print $terms ?>

I have done the following in my template.php, but its not working how I'd like.

To _phptemplate_variables, I have added the line

$vars['terms'] = mytheme_print_terms($vars['nid']);

Then I have created the function below:

function mytheme_print_terms($nid) {
     $terms = taxonomy_node_get_terms($nid);
     $allowed_vocabularies = array(
      "Vocab1",
      "Vocab2",
     );
     $output = '<ul>';
     foreach($terms as $term) {
       $vocabulary = taxonomy_get_vocabulary($term->vid);
       if ( in_array($vocabulary,$allowed_vocabularies) ) {

         $links = array();
         $output .= '<li>';
         $links[] = l($term->name, taxonomy_term_path($term), array('rel' => 'tag', 'title' => strip_tags($term->description)));
         $output .= implode(', ', $links);
         $output .= '</li>';
       }
     }
     $output .= '</ul>';
     return $output;
}

Does anyone have some advice for me? Any help would be greatly appreciated.

Comments

WorldFallz’s picture

perhaps a look at http://drupal.org/project/taxonomy_hide can point you in the right direction....

===
"Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime."
-- Lao Tzu
"God helps those who help themselves." -- Benjamin Franklin
"Search is your best friend." -- Worldfallz