Drupal 6 - Row Count in Views Header


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.