Simple Search Form Tag

The Simple Search Form tag allows you to easily add a single-form search field to your site. This allows you to have a simple search box in a sidebar of your site. Example:

{exp:search:simple_form weblog="news"}

<p><label for="keywords">Search:</label><br />
<input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100" /></p>

<p><a href="{path=search/index}">Advanced Search</a></p>

<p><input type="submit" value="submit" class="submit" /></p>

{/exp:search:simple_form}

The search results are displayed on the page you specify as the results= page. Results are displayed with the Search Results tag.

Input Fields

Keywords

The primary search method is to search by keyword. If you change the form field, you need to be sure to leave the name="keywords" attribute alone.

<label for="keywords">Keywords:</label><br />
<input type="text" name="keywords" id="keywords" maxlength="100" size="20" />

Member Name

You may optionally search by member name (the screen name) by adding this field to your form. If you change the form field, you need to be sure to leave the name="member_name" attribute alone.

<label for="member_name">Member Name:</label><br />
<input type="text" name="member_name" id="member_name" maxlength="100" size="40" />

Exact Matching

If you offer the ability to search by member name, then you may also offer the option of matching partial member names or exact member names. If you change the form field, you need to be sure to leave the name="exact_match" attribute alone.

<input type="checkbox" name="exact_match" id="exact_match" value="y" /> <label for="exact_match">Match Name Exactly</label>

Parameters

result_page=

result_page="news/searches"

The Template_Group/Template to which you would like the search results to point. If you do not specify this parameter, then it will default to "search/results", which is the default location of the search results Template.

results=

results="20"

The number of results to show per page on the search results.

search_in=

search_in="entries" search_in="everywhere" search_in="titles"

This parameter specifies which fields you would like to include in the searching. There are three possible values:

  1. entries: The search will be conducted in the entry fields of your weblog. The entry titles and any associated comments will not be included.
  2. everywhere: The search will be conducted in the title, entry fields, and in associated comments.
  3. titles: The search will be conducted in the title of your entries. The weblog entry fields and any associated comments will not be included.

If this parameter is not set, the search will default to only search by "titles".

status=

status="open"

The weblog status to which you would like to restrict searching. You can choose multiple statuses using a pipe:

status="draft|reviewed|published"

Or exclude statuses using "not"

status="not submitted|processing|closed"

weblog=

weblog="which"

From which weblog to search the entries. Additionally, you can use the pipe character to separate multiple weblogs:

weblog="weblog1|weblog2|weblog3"

Or you can add the word "not" (with a space after it) to exclude weblogs:

weblog="not weblog1|weblog2|weblog3"

Variables

There are no specific variables associated with the Simple Search Form. You may use the {path=} Global Variable to create a link to an Advanced Search Form if you wish.