Trent Wyman


Embedding a Drupal View into a Node Template (.tpl)

Categories:

The script below is an example of how to embed a view into a node template (.tpl file) in Drupal.

<?php
/* Invoke the views module and assign to a variable */
$myVar = module_invoke('views', 'block' , 'view', 'my-block_id');
/* Note: replace the parameter "block" with "page" to embed a page view instead */
?>

<?php
/* Display the view by printing the variable */
print $myVar['content'];
?>


Announcements

DrupalCon Denver 2012 - I'm Going!

Press Release:
Michael C. Carlos Museum

Read the press release announcing the Drupal redesign of Emory University's Michael C. Carlos Museum. View Press Release