How can I use a views template to modify the titles of taxonomy links? I have a view that shows a field which is a taxonomy term reference set to display each term as a link.  The taxonomy names are quite long so I want to rewrite them using a views template.

I made a template like this:

foreach ($row-&gt;field_field_ad_purpose as $data):
  if ($data['rendered']['#title'] == 'Apples, oranges, pears, and strawberries'):
    $data['rendered']['#title'] = 'Fruits';
  print $output;


Using dpm(), I was able to confirm that the #title is in fact shortened.  However, printing $output prints out the original title.  I also tried printing $data, but this just gives Array.  What is the function to call to print out the term as a link?
You need to create another field with the 'path' and set this to not display by default within the views UI.

You can then get the 'path' variable in your template along with the 'title' variable and create your link using Drupals l() function.

   print l($data['rendered']['#title'], $path);


http://api.drupal.org/api/drupal/includes%21common.inc/function/l/7