What is the right syntax whn you want to embed
http://example.com/mp3list?filter0=75
The documentation says
function views_build_view($type, &$view, $args = array(), $use_pager = false, $limit = 0, $page = 0, $offset = 0, $filters = NULL)
* @param $filters
* An array of exposed filter ops and values to use with the exposed filter system
* Array has the form:
* [0] => array('op' => 'foo', 'value' => 'bar'),
* [1] => array('value' => 'zoo'), // for a locked operator, e.g.
But how do you actually embed a view with filters in it.
i.e. I want to see the view 'mp3list' with filter0 set to 75
I thought about using this code
$view = views_get_view('mp3list');
$view->filter[0]['#value'] = '75';
print views_build_view('embed', $view, $args);
But it doesn't work.
What is the right syntax whn you want to embed
http://example.com/mp3list?filter0=75
?
Comments
Comment #1
merlinofchaos commentedThe last argument to views_build_view is the filters:
So, you have to set your filter in that array, and pass that argument.
Comment #2
MauMau"So, you have to set your filter in that array, and pass that argument"
I knew that. I just made a zillion errors in the syntax.
For people with my feeble grasp of the syntax, here's what you do in real life:
This gives you (more or less)
http://example.com/mp3list?filter0=75&filter1=47
One day, after views 2 is out, I might collaborate with someone smart on writing a usage.txt for views.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #4
leovarg commentedhow do you do this with view 6?