Retired Documentation:  You are using the documentation for version 1.7.3 which was retired in 2013. Go here for the latest version documentation or check here for your available upgrades to the latest version.

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 result_page= 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>

Include Expired Entries

Besides specifying whether expired entries are included in the search using the show_expired="yes" parameter, it is also possible to include a form field to let the user choose. If you change the form field, you need to be sure to leave the name="show_expired" attribute alone.

<label for="field_show_expired">Include Expired Entries?</label>
<select name="show_expired" id="field_show_expired">
<option value="no">No</option>
<option value="yes">Yes</option>
</select>

Include Future Entries

Besides specifying whether future entries are included in the search using the show_future_entries="yes" parameter, it is also possible to include a form field to let the user choose. If you change the form field, you need to be sure to leave the name="show_future_entries" attribute alone.

<label for="field_show_future_entries">Include Future Entries?</label>
<select name="show_future_entries" id="field_show_future_entries">
<option value="no">No</option>
<option value="yes">Yes</option>
</select>

Parameters

id=

id="search_form"

Specify the ID attribute for the <form> tag, which will allow you to style the form more easily.

name=

name="search_form"

Specify the name attribute for the <form> tag, which will allow you to specify CSS and JavaScript to the form more easily.

no_result_page=

no_result_page="search/noresults"

You may specify a particular Template to display in the case when there are no results. This takes a standard "Template_Group/Template" as input.

result_page=

result_page="news/searches"

The Template_Group/Template where you would like the search results to be shown. 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 and titles of your weblog. The 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".

show_expired=

show_expired="yes"

With this parameter you can specify whether or not expired entries will be included in search results. The default behavior is for expired entries to not be included. You may set this parameter to "yes" or "no". You may also let the user choose by using an Include Expired Entries form field.

show_future_entries=

show_future_entries="yes"

With this parameter you can specify whether or not entries with the date set in the future will be included in search results. The default behavior is for future entries to not be included. You may set this parameter to "yes" or "no". You may also let the user choose by using an Include Future Entries form field.

status=

status="open"

You may restrict the result to entries assigned to a particular status. 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"

where=

where="all"

This parameter allows you to specify how matching in searches are performed. The options are:

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.

Top of Page