How to get the total number of nodes displayed by the view

There are times where we would want to view the total number of rows or data rows displayed in a view. The best way to do is to add a PHP snippet in the header section of a view. Fortunately, drupal views allow for adding code snippet into header and footer of a view.

However, this code snippet will work only if pager is enabled in the view. The code snippet:

<?php
  $view
= views_get_current_view();
  print
"<h4> Total Blood Banks: ".$view->total_rows." </h4>";
?>

In-case, you would want to get data from a particular view, you can provide the snippet:
$view = views_get_view('view_name');

Happy Drupaling!

Technologies: