Drupal 7 – Printing a Views Results (Array)

If you ever want to view the array of a views results so that you can extend or modify the view, you can use the following code.

[php]
<?php $myview = views_get_view(‘whats_new’); $myview->set_display(‘page’);
$myview->pre_execute();
$myview->execute();
dpm($myview->result);
?>
[/php]

You’ll need to have the Devel module installed and turned on in order for the dpm function to work.




Leave a Reply

Your email address will not be published. Required fields are marked *