Shouldn't l() use whatever is set here?

nicknickoli - September 21, 2009 - 22:03
Project:Taxonomy Redirect
Version:6.x-1.3
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hi, I'm rewriting term links on my nodes to use a comma seperator. For some reason,

<?php
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'], ', ');

#1

nicknickoli - September 21, 2009 - 22:06

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

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

#2

Justin W Freeman - November 14, 2009 - 05:46
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.

#3

System Message - November 28, 2009 - 05:50
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.