Table of Contents

ToplistX includes a script that your website visitors can use to search your account database. This will allow them to quickly find the content they are looking for on your site. The search function is not enabled on the software's default template set, so this document will assist you in setting it up.

Adding a Search Box

Adding a search box on your ranking pages is pretty straightforward. Here is some example code: <form action="../../../../external.html?link={$config.install_url}/search.php" method="post"> <input type="text" name="s" value="" /> {categories var=$categories} {if count($categories)} <select name="c"> <option value="0">All Categories</option> {foreach var=$category from=$categories} <option value="{$category.category_id|htmlspecialchars}">{$|htmlspecialchars}</option> {/foreach} </select> {/if} <input type="submit" value="Search" /> </form> You can use this code pretty much anywhere on your ranking page templates.

Searched Fields

The end-user account search function will search the title, description and keywords fields for all of the accounts that currently are currently active and not suspended. This will ensure that your pending or suspended accounts will not show up as search results.

Boolean Mode Search

The end-user account search function uses boolean mode searches, just like you can use for some fields in the ToplistX control panel. The Boolean Searches section of the software manual describes the available options and restrictions for using boolean mode searches. You may want to provide your users with details on the different search formats they can use. Feel free to copy the information from the Boolean Searches section of the software manual to use for your end-user documentation.

Search Caching

To help reduce the load caused by offering a search feature, the software uses a caching system. Search results will be cached for 1 hour, so if another user comes along within 1 hour and enters the same search term as a previous user, the cached results will be displayed. This will reduce the number of database queries required, but you do need to be aware of the caching system when you are testing the search feature. If you do a search and a new account is added within 1 hour, don't expect that new account to immediately appear in the search results if you search for the exact same term.