1
votes

I'm currently using Drupal Views 2 to build custom views. This works fine so far, if there wasn't a feature needed: One should be able to filter the results by different fields via URL, in the form of:

http://domain/node/M/[key]:[value],[key2]:[value2],...,[keyN]:[valueN]

The key names are fixed and may not be altered.

I tried hooking hook_views_query_alter() and hook_views_pre_render() to generalize this for all views, evaluating the given filterset, but to no satisfying end, as i could not get hold of the query used to build the view (I could not alter it in the proper way, as i do not know the field names in the query).

The question is, if there is a nicer way to implement such a filterset.

thanks in advance,

flo

1
i am able to get the filter variables via drupals arg() - problem is that I don't know how to influence the view with their values :(Florian
If you're using the Views UI, then you can add arguments.Andrew Sledge
yeah but how? how can i get a view to accept url parameters in that certain form?Florian

1 Answers

1
votes

Looking at the comments you seem to want not only url arguments but url arguments in a custom format.

I would firstly urge you to drop your format and use the standard views argument format, this will be more standards compliant and save you a lot of headache.

If you want to use that paticular format you are going to have to write some custom code in a module.

  • Register a callback using hook_menu().

  • In that callback use arg() and decode your arguments.

  • Pass the arguments to views_embed_view(). as shown here