Not sure if this is the right place, or if it's perhaps a more general issue (maybe for views) but...

I need to be able to display a sort of landing page for an unfiltered view.

I'm filtering a collection of views based in a global filter. This is a postcode search and is working fine. What I need is another node to appear if there is NO value set in the global filter at all.

So, when you enter a postcode you get a table of results. When there's no filter set I don't want the full table to show, but another node explaining how to use search.

Any ideas? Even if it requires custom code. I'm stumped and just need a nudge in the right direction.

Cheers.

Comments

RdeBoer’s picture

Hi darksnow,

I can see the usefulness of this feature.
But I cannot see an easy way to realise it in a generic re-usable fashion.

In essence, what Views Global Filter does is pass to a number of Views a value for their contextual filters. I can't see how Views Global Filter can instruct Views to display one specific piece of content when the filter is set to none/all.

Is the postcode widget presented to the user as a drop-down or a text field?
A dirty workaround may be to first disable the "all" option in the Global Filter and then introduce as an option a bogus postcode that produces no results in the View. Then use the "No results behaviour" section in the Views UI to display what you want, for example a text you type or a "rendered entity" (i.e. the node you want to display).

Rik

darksnow’s picture

Thanks for the very quick response.

I did consider using the no result behaviour to do this, but if there is a filter which returns no results, then we have a different use case, so perhaps need a different page.

I guess this is more of a views question in relation to contextual filters, rather than one for you.

I'll ask the question again over in views. Cheers.

Martin...

RdeBoer’s picture

Status: Active » Closed (works as designed)

Ok. Closing here.