Last updated 29 August 2013. Created on 20 April 2011.
Edited by dman. Log in to edit this page.

If using the pager, that can display an indication of the number of items. But it you want an all-in-one list, it's often handy to have a sum at the bottom.

Use a PHP snippet

If you are happy to open up php format, edit your view and insert this code from faost

$current_view = views_get_current_view();
print count($current_view->result);

into the footer area.

Do it in one of your own modules

If you prefer to keep code in the modules, and not use PHP format in the UI, try something like this

 * HOOK_views_pre_render()
 * When rendering one of our own views, insert a count into the footer.
function MODULENAME_views_pre_render(&$view) {
  $view->style_plugin->display->handler->options['footer'] = count($view->result) . " items";
  $view->style_plugin->display->handler->options['defaults']['footer'] = FALSE;


Special modules

There are a couple of modules built to handle this also. It may be excessive to enable a whole module for something that can be done in such a small snippet, but:
views_calc Seems worth it.
views_record_count does the same.

Looking for support? Visit the forums, or join #drupal-support in IRC.