Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
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
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
Re: Filter searches
Thanks, I’ll give that a try.
Mark
Offline
Pages: 1