Fix for Taxonomy

  1. <?php
  2. /**
  3.  * Prints an unordered list of the terms (as links) that are
  4.  * associated to the currently displayed node.
  5.  */
  6. if ( arg(0) == 'node' && is_numeric(arg(1)) ) {
  7.     $node = node_load(arg(1));
  8.     if (module_exists('taxonomy')) {
  9.         $terms = taxonomy_link('taxonomy terms', $node);
  10. dsm(array_pop($terms)); //WHY does this show an array-element that is NOT in the $terms array?
  11.          dsm($terms);
  12. foreach ($terms as $k => $v) {
  13.    print '<a href="' . base_path() . $terms[$k][href] . '">' . $terms[$k][title] . ' &nbsp; | &nbsp;<//a>';
  14. //theme('links', $doug, array('class' => 'node-terms')). '&nbsp;&nbsp;&nbsp; |';
  15. }
  16.         print '<div style="clear:both;"></div>';
  17.     } else {
  18.         print 'No associated categories.';
  19.     }
  20. }
  21. ?>

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.