Web Design and Development Made Simple - Iceous Design by Jokosetio Halim
Aug 13, 2010
0 comments

Drupal Cheatsheet - Embedding views

Embedding views to content node

<?php
$view = views_get_view('review_list');
print $view->execute_display('default', array($node->nid));
?>

Embedding views with exposed filters and refresh to its own path on (default)

<?php
$view = views_get_view('product_listing'); 
        $view->override_path = $_GET['q'];
        $output = $view->preview();
        echo $output;
?>

Embedding views with exposed filters and refresh to its own path

<?php
$view = views_get_view('product_listing'); 
        $view->override_path = $_GET['q'];
        $view->set_display('page_2');
        $view->set_arguments(array('Laptop'));
        $output = $view->preview();
        echo $output;
?>
Add A Comment
Comment(*):
Your Name(*):
Email:
Website:
This is a captcha-picture. It is used to prevent mass-access by robots. (see: www.captcha.net)
Code in the picture:
 

My Blog RSS Newsfeed

Creative Circle

Design and Development

Creative Writing