Dynamic Argument Handling

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
tom friedhof's picture

Hello, I was wondering if there was a way to have the arguments feature of views only process arguments if the argument is preceded with the title of the argument defined in the view. To better explain what I mean, let me use the example in paragraph three in the "Views Arguments" Documentation:

A given view can have multiple arguments. For example, you might have blogs as a view, and provide UID, Year, Month, and Day as arguments in that order. Thus the URL might look like blogs/1/2006/3/15 which would display all blog posts written by user id #1 on March 15th, 2006. Arguments can also be specified as *, which will be interpreted as 'all values'; so in this case, blogs/*/2006/3/15 would show blog posts by ALL users on that date.

What I would like to accomplish is to get the same result as above, but with a url that looks like blogs/user/1/year/2006/month/3/day/15, and if one of those arguments is not present like blogs/user/1/year/2006/day/15, have it pull all blog entries for user 1 that were posted on the 15th day of every month in 2006.

It would be nice to have functionality like this because I've built several complex search forms that just create a url that is than processed by a custom module that builds a query based on what was passed in the url. I ran into a problem when I decided to duplicate the CCK type I was querying and realized that CCK changed the database schema and created tables for all the shared fields, which screwed up my query builder. I researched how views handled this and saw the brilliant query construction class that does all the joins and everything else and realized I was reinventing the wheel.

Anyway, I was wondering if anyone has dealt with the same issues. I'm not able to use the exposed filters features because my forms use AND's, OR's, and BETWEEN's. This leads to my next question. Is there a way to add an operator to arguments so you have "Is Greater Than"?

I'm looking at writing another views_ extension module to accomplish what I need, but wanted to make sure there already wasn't an easy way to accomplish this.

Thanks in advance,
Tom

Comments

Custom Argument handling

Crell's picture

If you haven't already, definitely look into PHP snippets in the custom Argument handling code. (Textarea right below the other arguments.) You can do all sorts of manipulation to the various arguments, including switching them around and setting things to NULL so that default "show all" behaviors work.

drupalmind's picture

is it essential if i use the the argument then i have to use the url like blog/2008/11/14? i will not use my own path setting for that