How to Programmatically Insert a View into a Drupal Node
Posted Tue, 05/18/2010 - 03:39 by Josh
Inserting a Drupal 6 view into a node or template file with PHP is easy. Just use the code below:
<?php
$viewName = 'the_name_of_my_view';
$display_id = 'block_1';
print views_embed_view($viewName, $display_id);
?>
The $viewName and $display_id can be found by exporting your view. The $display_id is the third argument of new_display:
<?php
$handler = $view->new_display('block', 'Block', 'block_1');
?>
(PHP tags added in the last example above only to colorize the code.)
- Tags:














