I am trying to create a directory type listing in Views. I used an argument that relied on a taxonomy term. I was hoping to show a listing of these terms and attendant counts of content - instead of the term names, I am getting term ID's. How do I get term names. I am able to do this if I use CCK fields, instead of taxonomy terms

Comments

iRex’s picture

This is what I'm getting:

91 (1)
103 (1)
104 (1)
113 (1)
124 (1)

... and this is what I would like to see:

Tourism (1)
Travel (1)
Soccer (1)
Rafting (1)
Bungee (1)

merlinofchaos’s picture

Status: Active » Closed (won't fix)

Why is a views question in ctools? (When you move/repost in Views, please attach an export of your view).

stefan looij’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Closed (won't fix) » Fixed

Answer (Drupal 6 & 7):

Copy the "views_view-summary.tpl.php" file your "modules/contrib/views/theme" folder.
(You can make it view or block specific by adding a filename-suffix.)

Note: if you use this as a admin view-display, make sure you copy this file within the admin theme folder. Not your default theme folder!

You don't need any changes in your display-settings.
Just adjust your tpl-override to the following lines, and your Term-ID's are converted to readable Term-names:

<div class="item-list">
  <ul class="views-summary">
    <?php foreach ($rows as $id => $row): ?>
    <li>
      <a href="<?php print $row->url; ?>"<?php print !empty($row_classes[$id]) ? ' class="'. $row_classes[$id] .'"' : ''; ?>>
        <?php
        /* begin replacement */
        $term_object = taxonomy_term_load($row->link);
        print  $term_object->name; 
        /* end replacement*/
        ?>
      </a>
      <?php if (!empty($options['count'])): ?>
      &nbsp;(<?php print $row->count?>)
      <?php endif; ?>
    </li>
    <?php endforeach; ?>
  </ul>
</div>
spencer95@gmail.com’s picture

Thanks that worked for me. Wish I'd found a few hours ago!

Status: Fixed » Closed (fixed)

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

jshosseini’s picture

Issue summary: View changes

please make a clear guide about this problem. how we can override this tpl file?