How can I look up the number of items in a Drupal View? I have several views on my Drupal site. I also have a page that links to those views. I would like to see the number of items (e.g. the number of pages) that are listed in each view:


link to foobar view [5 items]
link to other view [0 items]


Is there an easy way to do this. I suppose I will need embedded PHP for this, but I would like to avoid huge SQL statements embedded in my linking page.
You can get the amount of results in a view using their API calls. 

&lt;?php
$views = view::load("viewname");
$view-&gt;set_display('default'); //optional, could be default, OR the name of a specific display
$views-&gt;execute();
echo count($views-&gt;result);
?&gt;


I tested this on views 3 (the current version). For further reading, check out http://groups.drupal.org/node/10129. It's written for views 2, but still relevant.