Get a views result using PHP code, and iterate the proper way I have a view called all_projects_list. This view fetches Fields (not nodes), and i'd like to get it by code, and iterate on it. I managed to do this by using:

$view = views_get_view_result('all_projects_list', 'default');
foreach($view as $project){
    print_r($project-&gt;_field_data['nid']['entity']-&gt;field_project_code['und'][0]['value']);
}


Which as you can see is very, very dirty.
Is there a Drupal way of doing this ?
Thanks in advance.
It's not very different from what you do, but here's example code from a project of mine, showing how I usually do it

$view = views_get_view('a_view');
$view-&gt;preview('panel_pane_1', array($node-&gt;nid));
foreach ($view-&gt;result as $tid) {
  print $tid-&gt;taxonomy_term_data_taxonomy_term_hierarchy_tid;
}


Based on the function documentation


  To be called externally, probably by an AJAX handler of some flavor. Can also be called when views are embedded, as this guarantees normalized output.


I've always assumed that preview() is the proper way to do it, and it has served me well on a number of occasions.