How do I count the number of nodes in a View I would like to display the number of nodes in a particular view OUTSIDE OF THAT VIEW. For example, on the home page (page--front.tpl.php) I want to insert a simple php echo statement that pulls the number of nodes in "View X", and another php echo statement that pulls the number of nodes from "View Y", etc.

function theme_get_node_count($content_type) {
     $query = "SELECT COUNT(*) amount FROM {node} n ".
              "WHERE n.type = :type";
     $result = db_query($query, array(':type' =&gt; $content_type))-&gt;fetch();
     return $result-&gt;amount;
}


The previous code does not work because I am not counting a content type. Is there a $view variable I can plugin into this function to achieve the same results?

Thanks
In an executed view object, you can access how many rows or results are returned by looking at:

$count=count($view-&gt;results);


So, if your view returns 2 rows, $count would be 2, if 1, $count would be 1, etc. This can be accessed from a module that executed a view itself or from inside almost any of the views templates as well.