Drupal Association members fund grants that make connections all over the world.
In a Realty website, I have set up three blocks in the home page for listing the current projects, future projects and completed projects. I have setup three different views to print the project names into each of these blocks. Each of the views print only the top 5 projects in each of the blocks, based on the status of the project.
My requirement is to also print the total number of current projects in that block. I am using block-blockname.tpl.php to print the block as well as the view result count.
Following the solutions suggested in the post - http://drupal.org/node/131031, I have tried using "$view = views_get_current_view();" but it did not work. Further down in the same post, the following snippet was suggested by brian_c, which worked:
<?php // load view object (has no results yet) $view = views_get_view( 'name_of_view' ); // set arguments (if needed, otherwise omit this line) $view->set_arguments( array( 1, 2, 3 ) ); // execute view query $view->execute(); // results are now stored as an array in $view->result $count = count( $view->result ); ?>
It prints 10 with the view name that i am using for current projects. But there are 27 current projects and the view correctly returns all the 27 projects when viewed in the node. I have tried doing a print_r($view->result) in the home page block, it prints the project names with other values and prints only 10 of them.
Am I using the right method to print the count of view query?
Thanks in advance.