Drupal 6: Embedding a View in Drupal 6 using views_embed_view

Today I tried to embed the HTML from a View in a page layout following this guide. Apparently, in Drupal 6 the views_build_view function has been replaced by views_embed_view. Here's a code snippet that lets you to embed a view:

<?php
$viewName = 'MYVIEWNAME';
print views_embed_view($viewName);
?>

The views_embed_view function has 2 default arguments. The second argument allows you to enter the display_id of the view (example: default, page, block, etc). Any additional argument you specify will be passed to the views argument handler. For instance, if you wanted to embed the block view and pass it a list of arguments:

<?php
$viewName = 'MYVIEWNAME';
$display_id = 'block';
$myArgs = array(1, 2, 3);
print views_embed_view($viewName, $display_id, $myArgs);
?>

Or to implode numerous values into a single argument:

<?php
$viewName = 'MYVIEWNAME';
$display_id = 'block';
$myNodes = array(1, 2, 3);
print views_embed_view($viewName, $display_id, implode('+', $myNodes));
?>

Update 2008-11-07

views_embed_view does not show the view's title. Here's how you can get the title from the view object:

<?php
$viewName = 'MYVIEW';
$viewHtml = views_embed_view($viewName);
if ($viewHtml)
{
    // load view object
    $view = views_get_view($viewName);

    $title = $view->display['default']->display_options['title'];

    $page_contents .= "<h2>$title</h2>";
    $page_contents .= $viewHtml;
}
?>