Hi, I'm rewriting term links on my nodes to use a comma seperator. For some reason, l($taxonomy->name, 'term/'.$taxonomy->tid); doesn't print links to the page taxonomy_rewrite has set. Some vocabularies go to our 'topic" view, some go to our "lens" view.

Thanks for any help on this!

function phptemplate_preprocess_node(&$variables) 
{
// use commas instead of ordered list for terms
foreach($variables['node']->taxonomy as $tid => $taxonomy) {
	$variables['taxonomy_links'] .= l($taxonomy->name, 'term/'.$taxonomy->name, array('title' => $taxonomy->name)) .', ';
}
$variables['taxonomy_links'] = rtrim($variables['taxonomy_links'], ', ');

Comments

nicknickoli’s picture

Sorry, the links I'd expect to get rewritten on pages are coded as

print l($taxonomy->name, 'taxonomy/term/'.$taxonomy->tid);
agileware’s picture

Status: Active » Fixed

There is a note on the module page of this module that states that this module uses hook_term_path to rewrite term links.
This means that it is not actually a url redirect from taxonomy/term/tid to the new path, it is only a rewriting of the taxonomy links on the node pages.

If you output

  print l($taxonomy->name, 'taxonomy/term/' . $taxonomy->tid);

Then you will get exactly what you asked for, which will be taxonomy/term/tid

If you want to print the taxonomy term path for a term using taxonomy_redirect do this:

  print taxonomy_term_path($term);

That way taxonomy_redirect will be able to alter your link.

You pass into that function the term object that you want the link for.

Status: Fixed » Closed (fixed)

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