Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-07-21 20:43:39

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 169
Website

Filter searches

I would like visitors to be able to check off a number of search options, then apply them.

For example, these options could be chosen from three lists: type of pet (cat), age of pet (3), colour of pet (orange). A click would bring up a list of articles about orange, three-year-old cats.

MacUpdate has a filter that works something like what I have in mind, although it doesn’t necessarily have to be checkboxes.

Thanks for any help.


Mark

Offline

#2 2013-07-21 21:58:35

etc
Developer
Registered: 2010-11-11
Posts: 5,393
Website GitHub

Re: Filter searches

If you use radio buttons (or some other unique choice inputs) in your search form, that’s rather easy:

<input name="type" value="cat" type="radio" />
<input name="type" value="dog" type="radio" />
...
<input name="age" value="2" type="radio" />
<input name="age" value="3" type="radio" />
...
<input name="color" value="orange" type="radio" />

Name your respective custom fields type,age,color,.... Now you can filter <txp:article /> list with adi_gps or etc_query:

<txp:etc_query globals="_GET,_POST" specials="content">
	<txp:article type="{?type|%}" age="{?age|%}" color="{?color|%}" />
</txp:etc_query>

The headache begins when you need multiple choices…

Offline

#3 2013-07-21 22:02:56

mwr
Member
From: Canada
Registered: 2006-01-31
Posts: 169
Website

Re: Filter searches

Thanks, I’ll give that a try.


Mark

Offline

Board footer

Powered by FluxBB