Professional Documents
Culture Documents
Drupal 6 Views
Drupal 6 Views
What is View?
View is a powerful query builder for Drupal. Its let you fetch content from the database and present it to the user. Views can be used to generate reports, create summaries, and display collections of images and other content.
Adding a view
To add a new view, you need access admin/build/views/add menu
Adding a view
Fields
Relationships
Sort criteria
Filters
Arguments
Theming a view
Functions
views_get_view: Get a view from the database or from default views.
$view = views_get_view(my_view_name); $view->set_display(block_1); $view->set_arguments(array($my_param)); $view->execute(); foreach ($view->result as $result) { //My code here }
Functions
views_embed_view: Embed a view using a PHP snippet.
$viewName = 'MYVIEWNAME'; $display_id = 'block'; $myNodes = array(1, 2, 3); print views_embed_view($viewName, $display_id, implode('+', $myNodes));
Thanks