NAT settings printing terms by PHP
Macarro - June 8, 2008 - 19:39
| Project: | Node Auto Term [NAT] |
| Version: | 5.x-2.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
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:
<?php
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.

#1
NAT 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
#2
Automatically closed -- issue fixed for 2 weeks with no activity.