Here is a way to embed Drupal views directly into a page, without having to use panels, blocks and that sort of thing. You will need to add this code to your page using the PHP Text Format.
<?php $view = views_get_view('your_view_name'); $output = $view->preview(); if ($view->result) { print $output; } ?>
To get your views 'machine name' you can rollover it in the Views list page (/admin/structure/views). Basically it should be the name of your view without caps & spaces.
You can also specify other things like arguments, additional code, and display information like this:
<?php $view = views_get_view('your_view_name'); $view->set_display('panel_pane_1'); $output = $view->preview(); if ($view->result) { print "<h2 class='newsHeadline'>Latest News</h2>"; print "<div class='newsBody'>"; print $output; print "</div>"; } ?>
For a more in-depth look at what's possible see this link.
Drupal version:

Justin Chevallier
Avid Drupal site builder & user for +10 years.
Add new comment