Reputation: 1096
I'm using Drupal 6 and have a view with a field having the taxonomy name.
But I want to get the root taxonomy name. How can I have this?
Thanks in advance.
Upvotes: 2
Views: 1396
Reputation: 5211
Ok, I haven't found a way to do this purely through the Views administration, but you could create a template file for a Views field to do this. It sounds like you want to replace the term name with the root name...
If you could make that field have the taxonomy term id (tid) instead of the name, you can create a template for the field (determine the name for the tpl file under Basic Settings->Theme) and add this code:
<?php
$term_parents = taxonomy_get_parents_all($output);
print $term_parents[count($term_parents) - 1]->name;
?>
This will replace the term id and instead will display the root term name in its place.
If you are stuck on using the name, you could always throw a database query in there to convert the name to the term id to use with the template code.
Upvotes: 1