When theming Drupal and wanting to output a view there are occasions where using a view display (e.g. a page, or a block - perhaps placed within a custom region ;-) ), or using Views Attach will not suffice.
Instead, you can embed a view using the following PHP snippet:
(NOTE: you'll need to have the core PHP input filter enabled if embedding in a node body)
$view = views_get_view('VIEWNAME');
print $view->preview('default');
?>
or, if you need to use an argument with the view:
$args = array(ARGUMENTS);
$view = views_get_view('VIEWNAME');
print $view->preview('default', $args);
?>
No comments:
Post a Comment