Closed (fixed)
Project:
Node Auto Term [NAT]
Version:
5.x-2.1
Component:
Code
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Jun 2008 at 19:39 UTC
Updated:
2 Mar 2009 at 21:00 UTC
Hi
I'm having a problem with NAT settings when I print the node terms using a custom php function.
I use a PHP function in my template.php file to print terms separated by vocabulary:
function orangexxx_taxonomy_links($node, $vid) {
//if the current node has taxonomy terms, get them
if (count($node->taxonomy)):
$tags = array();
foreach ($node->taxonomy as $term) {
if ($term->vid == $vid):
$tags[] = l($term->name, taxonomy_term_path($term));
endif;
}
if ($tags):
//get the vocabulary name and name it $name
$vocab = taxonomy_get_vocabulary($vid);
$name = $vocab->name;
$output .= implode(', ', $tags);
endif;
endif;
if ($output):
return $output;
endif;
}
The problem is that terms shown using this function doesn't link to the associated node rather than the taxonomy page. I've checked the option in NAT configuration but it doesn't seem to work with this custom shown terms.
Any idea of how to fix this issue? The problem seems to be in 'l($term->name, taxonomy_term_path($term))' but I can't figure what to do.
Kind regards and thanks in advance.
Comments
Comment #1
Zen commentedNAT only modifies the taxonomy links in the node view. You can use the code in NAT's hook_link_alter (and also keep an eye on http://drupal.org/node/370548 ) to get this done in your custom module / template function.
-K