Results of a Views display as an array (D7) With Views in D6, I was able to get the results of a Views display as an array and work with it using php code embedded in a node.

For example, using this code snippet:

$view = views_get_view('view_name', 1);
$view-&gt;set_display('block_1');  
$view-&gt;preview();
$MyArray = $view-&gt;result;


This allowed me to get the results of the 'block_1' view display into the $MyArray array.

However, I'm trying to do the same thing in D7 and all I'm getting is a list of all the nodes in the view I'm calling, and not the results of the view display.

How do I get the results of a view display in code for D7??
I think it has been replaced by the views_get_view_result() function. It returns:


  An array containing an object for each view item.


e.g.

$result = views_get_view_result('view_name', 'block_1');