How to pass filter to Views?

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


$view = views_get_view('popular_location_upcoming');
$filters = views_get_filter_values(array('filter0' => 'chicago'));
print views_build_view('block', $view, $args, false, 0, 0, 0, $filters);

                                     

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.