I created a view called 'splogs' to output a list terms from a vocabulary and the node count per term. The output was correct, but I needed some further customization. So, I tried to theme the view, and I tried all the suggested templates on the Theme: Information page, but none of them worked.

I tried the following template files (which I had placed into ... /sites/all/themes/mytheme ):
views-view--splogs-list.tpl.php
views-view-fields--splogs-list.tpl.php
views-view-field--splogs-list.tpl.php

Here is a a preview of the output:

Fantasy Wizard (1)
Hoophead (5)
Professor Ulane (3)
The Brain (2)

Here is the export code from my view:

$view = new view;
$view->name = 'splogs_list';
$view->description = 'A list of the splogs and node count';
$view->tag = 'splog';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('fields', array(
  'name' => array(
    'label' => '',
    'link_to_taxonomy' => 0,
    'exclude' => 0,
    'id' => 'name',
    'table' => 'term_data',
    'field' => 'name',
    'relationship' => 'none',
  ),
));
$handler->override_option('arguments', array(
  'tid' => array(
    'default_action' => 'summary asc',
    'style_plugin' => 'default_summary',
    'style_options' => array(
      'count' => 1,
      'override' => 0,
      'items_per_page' => '25',
    ),
    'wildcard' => 'all',
    'wildcard_substitution' => 'All',
    'title' => '',
    'default_argument_type' => 'fixed',
    'default_argument' => '',
    'validate_type' => 'none',
    'validate_fail' => 'not found',
    'break_phrase' => 0,
    'add_table' => 0,
    'require_value' => 0,
    'reduce_duplicates' => 0,
    'set_breadcrumb' => 0,
    'id' => 'tid',
    'table' => 'term_node',
    'field' => 'tid',
    'relationship' => 'none',
    'default_options_div_prefix' => '',
    'default_argument_user' => 0,
    'default_argument_fixed' => '',
    'default_argument_php' => '',
    'validate_argument_node_type' => array(
      'poll' => 0,
      'sikgallery' => 0,
      'sikslide' => 0,
      'sikgame' => 0,
      'book' => 0,
      'page' => 0,
      'sikvideo' => 0,
      'story' => 0,
    ),
    'validate_argument_node_access' => 0,
    'validate_argument_nid_type' => 'nid',
    'validate_argument_vocabulary' => array(
      '6' => 0,
      '7' => 0,
      '5' => 0,
      '3' => 0,
      '4' => 0,
      '2' => 0,
      '1' => 0,
    ),
    'validate_argument_type' => 'tid',
    'validate_argument_php' => '',
  ),
));
$handler->override_option('filters', array(
  'type' => array(
    'operator' => 'in',
    'value' => array(
      'story' => 'story',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'type',
    'table' => 'node',
    'field' => 'type',
    'relationship' => 'none',
  ),
  'vid' => array(
    'operator' => 'in',
    'value' => array(
      '7' => '7',
    ),
    'group' => '0',
    'exposed' => FALSE,
    'expose' => array(
      'operator' => FALSE,
      'label' => '',
    ),
    'id' => 'vid',
    'table' => 'term_data',
    'field' => 'vid',
    'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
  'type' => 'none',
));
$handler->override_option('items_per_page', 0);

Here is the SQL query:

SELECT term_node.tid AS term_node_tid,
   term_data.name AS term_data_name,
   COUNT(node.nid) AS num_records
 FROM node node 
 LEFT JOIN term_node term_node ON node.vid = term_node.vid
 LEFT JOIN term_data term_data ON term_node.tid = term_data.tid
 WHERE (node.type in ('story')) AND (term_data.vid in ('7'))
 GROUP BY term_data_name
  ORDER BY term_data_name ASC

I've been able to successfully theme views before, so I don't know why this one doesn't work. Any helpful suggestions would be really great - thanks.

Comments

merlinofchaos’s picture

Status: Active » Fixed

Summary views have their own template,s which regrettably are not yet in the theme: information list as they should be.

Try views-view-summary.tpl.php or views-view-summary-unformatted.tpl.php depending upon which summary style you're using. It follows the same rules as any other style. You'll find the templates in the views/theme directory.

apersaud’s picture

Thank you - that worked perfectly!

Status: Fixed » Closed (fixed)

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

larryc11’s picture

Customizing views-view-summary.tpl.php or views-view-summary-unformatted.tpl.php works if the all the summary lists should look the same. But what should I do if I want different customized summary lists? I've tried one advice to change the template name like so:

views-view-summary-VIEWNAME.tpl.php

where I make several summary templates for several views but Drupal still displayed the views as views-view-summary.tpl.php.

35 MINUTES LATER:
Sorry, never mind. I missed the fact that there should be two hyphens in the name of the customized template file, like so:

views-view-summary--VIEWNAME.tpl.php

dcrsys’s picture

This helps - Thank You!