Advanced Search Form Tag

The Advanced Search Form tag allows you to display a detailed search form that will allow your users to make "power searches" to find the information they need. Example:

{exp:search:advanced_form result_page="search/results"}

<table cellpadding='4' cellspacing='6' border='0' width='100%'>
<tr>
<td>

<fieldset class="fieldset">
<legend>{lang:search_by_keyword}</legend>

<input type="text" class="input" maxlength="100" size="40" name="keywords" style="width:100%;" />

<div class="default">
<select name="search_in">
<option value="titles" selected="selected">{lang:search_in_titles}</option>
<option value="entries">{lang:search_in_entries}</option>
<option value="everywhere" >{lang:search_everywhere}</option>
</select>
</div>

<div class="default">
<input type="checkbox" class="checkbox" name="exact_keyword" value="y" /> {lang:exact_phrase_match}


</fieldset>

</td><td>

<fieldset class="fieldset">
<legend>{lang:search_by_member_name}</legend>

<input type="text" class="input" maxlength="100" size="40" name="member_name" style="width:100%;" />
<div class="default"><input type="checkbox" class="checkbox" name="exact_match" value="y" /> {lang:exact_name_match}</div>

</fieldset>

</td>
</tr>
</table>

<table cellpadding='4' cellspacing='6' border='0' width='100%'>
<tr>
<td valign="top" width="50%">

<table cellpadding='0' cellspacing='0' border='0'>
<tr>
<td valign="top">

<div class="defaultBold">{lang:weblogs}</div>

<select id="weblog_id[]" name='weblog_id[]' class='multiselect' size='12' multiple='multiple' onchange='changemenu(this.selectedIndex);'>
{weblog_names}
</select>

</td>
<td valign="top" width="16">&nbsp;</td>
<td valign="top">

<div class="defaultBold">{lang:categories}</div>

<select name='cat_id[]' size='12' class='multiselect' multiple='multiple'>
<option value='all' selected="selected">{lang:any_category}</option>
</select>

</td>
</tr>
</table>

</td>
<td valign="top" width="50%">

<fieldset class="fieldset">
<legend>{lang:search_entries_from}</legend>

<select name="date" style="width:150px">
<option value="0" selected="selected">{lang:any_date}</option>
<option value="1" >{lang:today_and}</option>
<option value="7" >{lang:this_week_and}</option>
<option value="30" >{lang:one_month_ago_and}</option>
<option value="90" >{lang:three_months_ago_and}</option>
<option value="180" >{lang:six_months_ago_and}</option>
<option value="365" >{lang:one_year_ago_and}</option>
</select>

<div class="default">
<input type='radio' name='date_order' value='newer' class='radio' checked="checked" />&nbsp;{lang:newer}
<input type='radio' name='date_order' value='older' class='radio' />&nbsp;{lang:older}
</div>

</fieldset>

<div class="default"><br /></div>

<fieldset class="fieldset">
<legend>{lang:sort_results_by}</legend>

<select name="order_by">
<option value="date" >{lang:date}</option>
<option value="title" >{lang:title}</option>
<option value="most_comments" >{lang:most_comments}</option>
<option value="recent_comment" >{lang:recent_comment}</option>
</select>

<div class="default">
<input type='radio' name='sort_order' class="radio" value='desc' checked="checked" /> {lang:descending}
<input type='radio' name='sort_order' class="radio" value='asc' /> {lang:ascending}
</div>

</fieldset>

</td>
</tr>
</table>

<div class='searchSubmit'>
<input type='submit' value='Search' class='submit' />
</div>

{/exp:search:advanced_form}

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

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.

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

A full discussion of the available variables is not feasible there is a great deal of interdependence between the various form fields, variables, and javascript functions. The Parameters can be used to modify how the search behaves. If you wish to modify the search form itself, simply use the default form as a base and customize it from there.