Search Results Tag

The Search Results tag controls how you display results from your searches. Example:

<table border="0" cellpadding="6" cellspacing="1" width="100%">
<tr>
<th>{lang:title}</th>
<th>{lang:excerpt}</th>
<th>{lang:author}</th>
<th>{lang:date}</th>
<th>{lang:total_comments}</th>
<th>{lang:recent_comments}</th>
</tr>

{exp:search:search_results switch="resultRowOne|resultRowTwo"}

<tr class="{switch}">
<td width="30%" valign="top"><b><a href="{auto_path}">{title}</a></b></td>
<td width="30%" valign="top">{excerpt}</td>
<td width="10%" valign="top"><a href="{member_path=member/index}">{author}</a></td>
<td width="10%" valign="top">{entry_date format="%m/%d/%y"}</td>
<td width="10%" valign="top">{comment_total}</td>
<td width="10%" valign="top">{recent_comment_date format="%m/%d/%y"}</td>
</tr>

{/exp:search:search_results}

</table>

{if paginate}

<div class='paginate'>

<span class='pagecount'>{page_count}</span>&nbsp; {paginate}

</div>

{/if}

Parameters

switch=

switch="option_one|option_two"

This parameter allows you to set two values that will alternate between the result rows. This is commonly used to have alternating colored backgrounds for the result rows. This parameter works in conjunction with the {switch} variable.

Variables

auto_path

{auto_path}

This parameter is replaced with the URL to the entry. Unlike other "path" variables, this variable does not require the Template_Group/Template to be specified. Instead, the path will automatically be determined by the Weblog URL setting for the weblog in Weblog Management.

author

{author}

The author of the entry

comment_total

{comment_total}

The total number of comments for a particular entry

dates

Several date variables are available for use. As with other date variables, these require the "format" parameter in order to define how the date should be displayed. See the date variable formatting page for more information.

entry_date

{entry_date format="%Y %m %d"}

The date the entry was submitted

recent_comment_date

{recent_comment_date format="%Y %m %d"}

The date of the most recent comment associated with the entry

excerpt

{excerpt}

An excerpt from the entry. The excerpt consists of the first 50 words from the field specified for search excerpting in your Weblog Management settings for your weblogs.

keywords

{keywords}

Displays the keywords that were used in the search.

member_path

{member_path=member/index}

The Template_Group/Template with which to display the member profile of the author of the entry. Typically, this variable will be specified as {member_path=member/index}.

switch

{switch}

This variable is dynamically replaced by the appropriate value specified in the switch= parameter. This variable is commonly used to set a CSS class or a background color.

title

{title}

The title of the entry

weblog

{weblog}

The name of the weblog to which the result is assigned