Super Search 3.x

Legacy documentation for Super Search 3.x.

Super_Search:History template tag

The Super_Search:History method allows your users to view their search history. It displays a list of all saved search queries. A member may only view their own history, and cannot view someone else's history for privacy reasons. Searches must first be saved using the Super_Search:Save_Search_Form function upon completion of a search.

Each search query is saved to the database and given a unique search ID. That ID is then passed over to the Super_Search:Form tag, where Super Search will then parse and fill out all search query terms originally supplied for each search field.

{exp:super_search:history} content {/exp:super_search:history}

Parameters

The following parameters are available for use:

limit=

limit="10"

This parameter allows you to control how many results will be outputted. The default is 20.

orderby=

orderby="date"

This parameter allows you to specify whether to order your results by total number of results for the query (results) or the date the search was saved (date). Use the sort parameter to control whether the list is ascending or descending.

saved=

saved="no"

If this parameter is set to yes, only searches saved in your history will be shown. If set to no, only the last search you performed will be shown. Default is yes.

sort=

sort="desc"

This parameter is used in conjunction with the orderby parameter, and allows you to control whether the list is ascending (asc) or descending (desc).

Variables

The following variables are available for use:

super_search_date

{super_search_date format="%l, %F %j, %Y at %g:%i %a"}

This variable will output the date of when the search was performed.

super_search_id

{super_search_id}

This variable will output the ID of the search. This variable will be used to construct a link to your search form, and pass the search query ID to it.

super_search_name

{super_search_name}

This variable will output the name given to the search.

super_search_results

{super_search_results}

This variable will output the total number of results for the search query.

super_search_saved

{super_search_saved}

This variable will evaluate as y or n, depending on whether the search query was saved. This would likely be used as a conditional.

super_search_count

{super_search_count}

This variable will return the relative position number of the search query within the list of queries.

super_search_total_results

{super_search_total_results}

This variable will return the total amount of search query history results being displayed. You would typically use this in a conditional statement.

Conditionals

Conditionals are available on all variables. Additionally, the following conditionals are also available for use:

super_search_no_results

{if super_search_no_results}
    Sorry, no results were found.
{/if}

This conditional displays it's contents when there are no results found.

Examples

The following code sample is an example of how your Search History list might look:

<h3>Your Saved Searches</h3>

<ul>
    {exp:super_search:history limit="10"}
        <li>
            <a href="{path='supersearch/search'}/{super_search_id}/">
                {super_search_name}
            </a>:
            {super_search_results} results
            (searched on {super_search_date format="%F %j, %Y at %g:%i %a"})
        </li>
        {if super_search_no_results}
            <li>You have not saved any searches yet.</li>
        {/if}
    {/exp:super_search:history}
</ul>