Views going global

Views Contextual Filters aren't crap

This is about Views Contextual Filters.

No don't run away yet…. give me a sec… please.

I am well aware that even seasoned site builders fear to tread into that hidden-by-default upper right-hand corner of the Views UI configuration page labelled "Advanced". Most of us have opened it once, seen the heading "Contextual Filters" and gone "Mwaaah… what's that cr@p and what good is it to me?"

Well quite a lot of good, actually. If you can just hang in there, I'll get straight to the point.

You need contextual filters instead of, or in addition to, normal filters when:
1) you want to pass arguments to a View that has no exposed filter UI or that needs its UI bypassed initially, e.g. from links elsewhere on the same or another site, or in an email or newsletter
2) you want to do funky stuff with Panels and the like, which we won't discuss here
3) you want to pass a filter argument to many different Views at once, residing as pages and in blocks, all from a single UI widget, which you can place as a little block anywhere on your site -- the picked once, operates site-wide (POOS) filter principle.

That last quality facilitates UX enhancements many continue to ask for and for good reason.

Here's a few use-cases:
o a visitors lands anywhere on a site, be it one for real estate, events or travel and enters state, city or postcode of interest; instantly all relevant pages on the site filter on the region entered, without the visitor having to re-enter their selection again, unless they wish to change it
o a user visits an online gift ship, enters maximum spend and... *poofff*... only sees applicable merchandise on any of the pages they visit
o same for date ranges, music genres... any taxonomy terms, any field occurring in more than one View on your site

So how do you give your plain contextual filters the far-ranging wings of point 3) ? Views Global Filter, that's how. Try it.

And if after that you still dislike contextual filters, write to us -- you'd be the first to complain.

                                                                                 * * *

Note re point 1) above: if you want to contextually pass to a View filter ranges, e.g. 50--150, rather than single values, check out Views Contextual Range Filter

File under: 

Spare a thought for contrib

Read More »