I have a related_news view that uses a taxonomy name argument. I am embedding this view in a template. Apart from the fact that the view title doesn't render (the subject of another post: http://drupal.org/node/141820) , it works fine if I am only passing in one taxonomy name.
But I want to be able to get related news for multiple taxonomy terms. Do I need to create separate arguments to pass in multiple terms? Or can I pass multiple terms to the same argument? If the latter, how do I do this?
Right now, my code looks like this:
$myview_args = array(0 => $my_topic );
print views_build_view('block', $myview, $myview_args, false, 4);
$my_topic above is a taxonomy term name. I would like to pass in two or more names and get all the related nodes back.
Would really appreciate the help. Thanks.
Comments
Perhaps you can get it
Perhaps you can get it working with Arguments Handling Code.
The views fusion module may help too.
This is not an unreasonable question
Bumping.
I have searched for the answer in vain.
I have also tried doing my settings through filters rather than arguments. This doesn't work either.
Hasn't anyone tried to dynamically set their filters during embedding?
All right, I think I got it
Instead of using an argument for my term name, I switched to filters since it allows for multiple values. I added a filter for the taxonomy term and a filter for the node type. I exposed the filters. It seemed that if I didn't expose them, I couldn't change their settings dynamically.
After doing this my embedding code ending up like this:
I checked and it seems that
I checked and it seems that using term name seems to be limited to one argument:
http://drupal.org/node/77543
Conversely, using TID is enhanced to work like this:
http://(site).com/taxonomy/term/253+145
But you are in the right path by using the views API.
Using two dynamic filters of TID work, as you note, but using term names might fail again.
If everything else fail, try using sql queries directly, using query_alter, like this:
patch
I just submitted a patch to fix this in views.
http://drupal.org/node/77543#comment-633801