Just spent a long time figuring out how to get the taxonomy terms to display in my block using taxonomy_node_get_terms, when I realized that the terms are there, but they're not actually linked to anything. Gah!

What I really need is the same $terms variable that's available to the node.tpl.php. Is there some way that I can hijack that variable and send it to the block? It seems such a waste when the variable is already packaged and going somewhere that it can't be used. It's so elegant - just one little word. One little line of code. Seems so silly to go to all that effort to rebuild it (it's already been more time than I budgeted for) when it's already there.

Any ideas? I'd appreciate greatly any help I can get.

Comments

newbstah’s picture

Looked in the module and found this. Works like a charm:

<?php if (module_exists('taxonomy')) {
$terms = taxonomy_link('taxonomy terms', $node);
print theme('links', $terms);
}?>
binhcan’s picture

When the $terms variable is not available the $node variable is also not available. I miserably wasted time figuring out how to load the $node variable in a block before ;)

clown10’s picture

Do you know how this would work in Drupal 6?