Sidebar

startup_tutorial_and_checklist:feature_configuration:search_configuration:searches_through_url

Passing Searches Through Urls

You can pass search variables through a url link. To search a specific field use the name of the HTML input tag within the source of the search form as the name of variable passed and its value as the term you want to search that term for.

To do a basic search for your whole site

http://example.com/index.php?a=19&b[search_text]=searching+for+something&b[search_titles]=1&b[search_descriptions]=1

where "searching for something" is what you are searching for. Any values passed by URL must be urlencoded. Unless there are special characters the only thing you should need to do is replace " " (spaces) with "+" (plus signs)1).

To search a specific category (and its subcategories):

http://example.com/index.php?a=19&b[search_text]=searching+for+something&c=###&b[subcategories_also]=1

where ### is the category id number for the category you wish to search.

For basic text searches of fields…

http://www.yoursite.com/index.php?a=19&b[optional_field_1]=ford&b[optional_field_2]=green

For range searches on number only site wide fields…

http://example.com/index.php?a=19&b[optional_field_1_lower]=1970&b[optional_field_1_higher]=1975

The secret to creating these searches is duplicating the form in the variables it submits and the names used for those variables.

<tip c n>Note that URL's cannot have any spaces (ie " ") within them. If there is a space any data after the space within the url will be ignored.</tip>

1)
The reason for this is to make sure it is formatted correctly for the URL. This is not something specific to the software, it is just how a URL works for any website. For example, if you do a search in http://google.com and include a space in the search, look in the address bar, the part that contains your search terms will have replaced the spaces with plus.
startup_tutorial_and_checklist/feature_configuration/search_configuration/searches_through_url.txt · Last modified: 2014/09/25 16:55 (external edit)