Documentation

Hey there, it looks like you've been redirected from designsandcode.com - as you can see we have a new home - read more

Accessing the Search Data

Since 2.0, we have a new class for handling Search Data which will be improved upon in 2.1.

This allows you to add some of the things the user has searched for to your page titles, or display the current users’ search/filter settings anywhere on the page.

Access the Active Query Object

Grab the query object – remember to replace the ID with the ID of your search form

Get a Single Field by Field Name

Get labels for Multiple Fields by Field Name

Get an array of filters with values and labels

Get the Search Term

Check to see if anything has been filtered

How to get the field name?

This is fairly easy.  The field name is what goes in the URL when you perform a search. So if I performed a search using categories and tags my URL might look like:

http://www.yoursite.com/?sfid=1526&_sf_s=searchterm&_sft_post_tag=extra-large&_sft_category=shorts

So in this case, the field names for my Category Field and Tag fields are:

_sft_post_tag
_sft_category

This is taken from:

http://www.yoursite.com/?sfid=1526&_sf_s=searchterm&_sft_post_tag=extra-large&_sft_category=shorts