This site is not supported for Internet Explorer 6. It might look funny or even not function properly if you are using this browser.
You upgrade Flash as soon as they get a new version. Why not get an updated browser?
Try Firefox, Chrome or if you love and breath Microsoft than IE7.
In trying to keep the amount of new views created on the site I'm working on I wanted to programmitcally change certain portions of a view to use the same output but different inputs. In background I'm using Drupal 6 with Views 2 API.
Specifically I wanted to change the number of items and node type filter. Though this could be expanded to changing the sort, arguments or fields returned as well.
Thanks to some great help from Nathan Rambeck I was able to get this working with the following code:
$view_args = array(); //Array of arguments $display_id = 'block_1'; $view = views_get_view('viewname'); //Name of your view $view->set_display($display_id); $view->display_handler->set_option('items_per_page',5); //Set the number of items to return $view->set_item($display_id,'filter','type',NULL); // Get rid of any current node type filters. /******************* * Below we construct the new filter array. * I got this be creating a test view and stealing this array from the export code. * It was located in the $handler->override_option('filters', array()) code of the export. *******************/ $filteroptions = array( 'operator' => 'in', 'value' => array( 'ctype_name' => 'ctype_name', //Change each ctype_name to the machine name of your content type 'ctype_name' => 'ctype_name', ), 'group' => '0', 'exposed' => FALSE, 'expose' => array( 'operator' => FALSE, 'label' => '', )); $view->add_item($display_id,'filter','node','type',$filteroptions); //Add the new filter back to the $view object. print $view->preview($display_id , $view_args);
Hopefully this will help anyone else trying to programmitcally change Views filters or work with the Drupal Views 2 API.