Hi,

How can I make Taxonomy Redirect work with this template.php snippet to create comma separated tags on my node page?

<?php
function phptemplate_preprocess_node(&$vars) {

  // Taxonomy hook to show comma separated terms
  if (module_exists('taxonomy')) {
    $term_links = array();
    foreach ($vars['node']->taxonomy as $term) {
      $term_links[] = l($term->name, 'taxonomy/term/' . $term->tid,
        array(
          'attributes' => array(
            'title' => $term->description
        )));
    }
    $vars['node_terms'] = implode(', ', $term_links);
  }

}
?>

Comments

Danny_Joris’s picture

Ok, I fixed it. I changed the output into the output I normally use with the Taxonomy Redirect module...

<?php
function phptemplate_preprocess_node(&$vars) {

  // Taxonomy hook to show comma separated terms
  if (module_exists('taxonomy')) {
    $term_links = array();
    foreach ($vars['node']->taxonomy as $term) {
      //Custom: I changed the output into the output I generate with the Taxonomy Redirect module.
      $term_links[] = l($term->name, 'tags/' . $term->name,
        array(
          'attributes' => array(
            'title' => $term->description
        )));
    }
    $vars['node_terms'] = implode(', ', $term_links);
  }
}
?>
Agileware’s picture

The original code snippet is not so good.
Taxonomy paths should not be hard coded like that.

If you use this it will work without you having to hard code your redirect.
So you won't have to update your theme every time you change the redirect.

<?php
function phptemplate_preprocess_node(&$vars) {
  // Taxonomy hook to show comma separated terms
  if (module_exists('taxonomy')) {
    $term_links = array();
    foreach ($vars['node']->taxonomy as $term) {
      $term_links[] = taxonomy_term_path($term);
    }
    $vars['node_terms'] = implode(', ', $term_links);
  }
}
?>
Agileware’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.