Return to Snippet

Revision: 43507
at March 25, 2011 06:54 by Onfire60


Initial Code
<?php

// load view object (has no results yet)
$view = views_get_current_view();

// execute view query
$view->execute();
$total =0;
foreach ( $view->result as $k=> $v ) {
$total += $v->node_data_field_paymen_total_value;
}

// results are now stored as an array in $view->result
$count = count( $view->result );

print "Total Number of Payments :  <b>$count</b><br />";
Print "Total Payments :$<b>$total</b> ";
?>

Initial URL
http://www.impossible.co.in/blog/admin/drupal-views-get-total-rows-and-field-values-header

Initial Description
Found This Code to make a stats page view for a client. Make Sure your header input format is PHP.

Initial Title
Drupal 6 - Row Count in Views Header

Initial Tags
drupal

Initial Language
PHP