(How To) How to programmatically insert a view into a tpl or content in Drupal 6

Tips: How to programmatically insert a view into a tpl or content in Drupal 6

"In Drupal 6 views has been completely rewritten from the ground up, and as such we have to adjust the little code snippets that we developers have collected over the years to compensate."

The old way ( Drupal 5 views 1 ) of inserting a view into a tpl or into a php enabled content area was as follows: 

<?php
$view_name = 'text_listing'; //name of view
$view_args = array($oldstring) ;
$view = views_get_view($view_name);
print views_build_view('embed', $view, $view_args, $view->use_pager, $view->nodes_per_page);
?>

This has now changed to the following:

<?php
  $view_args = array();
  $display_id = 'page_1';
  $view = views_get_view('logo_slideshow');
       if (!empty($view)) {
        print $view->execute_display($display_id , $view_args);
  }
?>

Now at first this might not seem much different, but watch out. There are some new pitfalls in views 2 that make this a little trickier to pull off.

| Read more..

Courtesy : Pixelclever.com