We just upgraded from Drupal 5 to Drupal 6.

In Drupal 5, I would create a view and loop through its contents in the following way:

	$view_name = 'ShopsByLocation'; //name of view
	$limit = 0; // number of returns
	$view_args = array($_SESSION['location_id']);
	$view = views_get_view($view_name);

	$items = views_build_view('items', $view, $view_args, FALSE, $limit);
	foreach($items['items'] as $item){
               $node = node_load($item->nid); 
            }

Drupal 6 done away with the views_build_view function. Posts say you can replace it with the views_embed_view function. However, I don't want to just render the view as html. I want to store the view's info in an array that I can loop through
as I could with views_build_view. I guess I'm not sure how to get a node's information from a view in Drupal 6. Any help would be
appreciated.

Thanks

Comments

jniesen’s picture

    $view->render();
    foreach ($view->result as $result) {
        $node = node_load($result->nid);
    }

Not sure if this is the most optimal, but it works

xamount’s picture