views:

942

answers:

3

Hi all, I'm theming a node-MyContentType.tpl and I would like the ability to 'print' only a specific Vocabulary.

In other words, I would like something like that:

<Title>
<Vocabulary [1]>
<Body> 
<Vocabulary [2]>

I think it should be fairly easy, but I'm struggling.... Ideally, I would love to pass arguments to:

  • print the "label" of the vocabulary (I'm currently doing it with a module )
  • print the term as a link
  • print the description of that term

Hope somebody can help me, thanks

A: 

The Taxonomy Hide module gives you some fancy configurations with which to hide vocabularies and terms from display. Unless you have a complex use case that might change over time, you might want to hard-code it.

Take a look at taxonomy_hide_nodeapi() to get some ideas how you might adjust it to suit your needs. Interesting snippet:

foreach ($node->taxonomy as $key => $value) {
  if (array_key_exists($value->vid, $hidden)) {
    unset($node->taxonomy[$key]);

Grayside
A: 

ok, here is what I have so far:

<?php
foreach ( (array)$node->taxonomy as $term ) {
  // $term->name has the taxonomy term name
  // $term->tid has the taxonomy term id

$TermTitle = $term->name;
$TermDescription = $term->description;

print ($TermTitle);
print $TermDescription;
}
?>

Now, could somebody help me so that this only print a specific vocabulary, thanks

A: 

another easy solution is you can use taxonomy treemenu module download here, it will then read QUICKSTART file from there to know how create tree minue , go to block and you will find block for that menu , display it anywhere you need . (renamed the block in correct name if there is error message ) .