Posted By

Onfire60 on 03/25/11


Tagged

drupal views 6


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

ctronci


Drupal 6 - Row Count in Views Header


 / Published in: PHP
 

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

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

  1. <?php
  2.  
  3. // load view object (has no results yet)
  4. $view = views_get_current_view();
  5.  
  6. // execute view query
  7. $view->execute();
  8. $total =0;
  9. foreach ( $view->result as $k=> $v ) {
  10. $total += $v->node_data_field_paymen_total_value;
  11. }
  12.  
  13. // results are now stored as an array in $view->result
  14. $count = count( $view->result );
  15.  
  16. print "Total Number of Payments : <b>$count</b><br />";
  17. Print "Total Payments :$<b>$total</b> ";
  18. ?>

Report this snippet  

You need to login to post a comment.