Pace Solutions Blog

Web 2.0, e-Commerce, Joomla, WordPress, Facebook Applications, Drupal, Open Source, CMS, PHP, MySQL, AJAX

Posts Tagged ‘Drupal Help’

Display view inside a view

Wednesday, July 8th, 2009

Drupal 6 replaces the views_build_view by views_embed_view, which make sense at least by the name of function.

$viewName = 'MYVIEWNAME';
print views_embed_view($viewName);

The views_embed_view has 2 default arguments. The second argument allows you to enter the display_id of the view (example: default, page, block, etc). Any additional argument you specify will be passed to the views argument handler. For instance, if you wanted to embed the block view and pass it a list of nodeIDs as an argument.

$viewName = 'MYVIEWNAME';
$display_id = 'block';
$myNodes = array(1, 2, 3);
print views_embed_view($viewName, $display_id, $myNodes);
Copyright © 2009, Pace Solutions. All rights reserved.
Privacy Policy | Terms of Use | FAQ's | Feedback | Contact Us
www.arslanrauf.com