Hi,
I am testing the panels 2.0-alpha7 with views 5.s-1.6 and it is great!
I can suggest these modules to the drupal communitiy it is a lot functionality improvement!
I succeeded in building a view with the possibility to get an hierarchy of terms.
I did this by using the views-filter possibility and selecting the top-term I wanted with a "3" in the option field (this way the views.module will filter 3 levels depth from the selected term).
With this view I can show all nodes from all terms underneath the selected top-term.
The only problem is I need to make a view for every top-term I want to have the nodes shown.
It would be great to make the filter possible with an argument. So that you don't need to select the top-term in the view-building, but can give the top-term as a % argument with the url.
Am I clear enough about my future request?
This way you don't have to build a lot of views, but could be able to control a lot of term hierarchy possibilities with one view!
Thanks for these great modules.
greetings,
Martijn
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | argument_handling_code.jpg | 68 KB | summit |
| #12 | views_filters.jpg | 49.96 KB | summit |
Comments
Comment #1
summit commentedHi,
Will it be possible to use the argument for filters, so you can build only one view and use the filter-criteria as arguments?
greetings,
Martijn
Comment #2
summit commentedchange title to be more specific.
It would be great if this variable will be possible. I don't have to make a view then for every specific filter-setting.
greetings,
Martijn
Comment #3
buffos commentedI second that. Actually filters are static arguments. So either argument could have more operators.
Comment #4
summit commentedHi,
May be there are allready possibilities with the Argument Handling Code.. but I am not that good of a programmer.
Please advice,
greetings,
Martijn
Comment #5
buffos commentedActually after a little bit of search its very easy.
Imagine you want the third filter of your view to contain a word.
You need this to be dynamic.
you set up the view normally. No argument. Just a little bit of argument handling code
You want to call the view with somthing like www.yoursite.com/viewname?searchword=blabla
Step 1
you put just the following
if($_GET['searchword']) { $someword = $_GET['searchword']; } else { $someword = ''; }
/***************************************************************************/
$view->filter[X]['value'] = $someword ;
$view->is_cacheable = 0;
return $args;
where X in the filters is the number of the filter you want to put the search word.
tada... very simple indeed
Comment #6
summit commentedHi,
I don't quite understand how I can use the views-filter-code in the argument-handling-code area.
I am not using arguments, but I would like the filter-options automated, so I can use one view for different websites.
See my post about this subject on: http://drupal.org/node/174714#comment-303683
Can you please help to get the code correct in the way you are dealing with the automated filter-code?
Thanks in advance,
Martijn
Comment #7
summit commentedHi,
How can I alter the following views-filter-export-output to working argument handling?
Something like
How do I now the filter[1] is correct?
Is this the correct writing of the code?
thanks in advance,
greetings,
Martijn
Comment #8
summit commentedHi,
What I would like to achieve is that my view gives other results on another url because of the filter-argument-handling.
So the url www.test.com should give another view because of the filter.
I tried to follow the above tips, but the view is not filtering on the term_node_140 on the end...
Do you need to set the filters also on the view, or is the argument handling enough?
Thanks for your help.
This is what I have so far, please alter code if necessary.
Comment #9
summit commentedHi,
I am not getting this to work, sorry people. I tried all sorts of methods last months..
I would really like to use the filter automated, so I don't have to make a view for every taxonomy term.
What I would like is to use the popular content view and be able to use the arguments as how to filter the view.
I am trying the following as stated above:
But I got all sorts of MYSQL errors.
Does anybody use the argument handling code to get the popular content view filters so that when you type in a termname as argument, the popular content from this termname and all hierarchies under this one will populate?
Please help?
thanks in advance,
greetings,
Martijn
Comment #10
summit commentedHi Kostas and others,
Kostas thanks for your response on: http://drupal.org/node/161795#comment-584596
Your solution is not exactly what I would like. Would you please assist me a little further?
What I would like is to be able to filter on the first (arg0) and second argument (arg1) in a url.
For example: the url is www.example.com/view_url/region/category
The url is build like this, because of other reasons, so searchword= is not an option for me.
I would like to be able to filter on region and on category.
The filters are the 4th and 5th in the row. So should be [3] and [4] in the array, right, counting the first as zero?
But how do I get the filter to work?
I tried the following in the argument handling code:
But it is not working. May be I need something as: if($_GET['searchword']) { $someword = $_GET['searchword']; } else { $someword = ''; }
But then related to my url need www.example.com/view_url/foo/bar
Can someone help me please?
Thanks in advance!
greetings,
Martijn
Comment #11
Piyavkin commentedHi, Martijn. You have asked me via my contact form about this point, but your contact form is disabled. I'm not sure that return address in the email yours. Where I should place my considerations about the issue?
Comment #12
summit commentedHI Dmitri,
Thanks for your post on: http://drupal.org/node/174714#comment-638306.
Related to your code, I tried building the code I need, but until now unsuccesfull.
I tried:
My url is www.example.com/view_url/foo/bar
I set the filter and it is the 3th filter, so the first is 0, so I need to use [2], right?
I set the arguments to two taxonomy terms. As seen in attached picture. This is possible by the patch:http://drupal.org/node/77543#comment-633801
I also attach a picture of my filter settings.
What's wrong with the code please, it still will not filter on the first argument (arg(0): foo with a depth of 3?
Thanks in advance for your reply!
greetings,
Martijn
Comment #13
Piyavkin commentedHi,
May be and may be not. Just see what is the filter's id exactly. Try this. Temporarily place as Argument Code this code:
It prints view object. Find [filter] array and check the real id of the filter.
Just delete both arguments. For your code above filter(s) only must be manually created.
If you provide the view as a block, then you must use not array $args, but function arg().
Also there may be mess in other fields and options. Verify and be accurate.
Comment #14
summit commentedHi,
I got something working with this argument handling code, thanks to Dmitri and others, thanks!
No arguments and two taxonomy term filters with a selection (the one will be overwritten by the argument handling code).
The patch http://drupal.org/node/77543#comment-634685 is installed in my testcase.
If you like to comment, or may be have better code to get this done, please reply!
Greetings,
Martijn
Comment #15
(not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.