Expression Engine provides a handy search module that provides an easy mechanism for adding a search facility to your site.
This first article implements a simple search box and results page.
Create the search box
This is a simple variation of the Simple Search Form from the EE documentation. This could be put into its own template or more likely be part of a global header embedded into every page.
{assign_variable:my_weblog="default_site"}
{assign_variable:my_template_group="site"}
{!-- your page header --}
{exp:search:simple_form weblog="{my_weblog}"}
{/exp:search:simple_form}
{!-- your page footer --}
An optional result_page="search/results” can be added to the exp:search:simple_form tag to specify the search results page.
An example search box can be seen here.
The search results page
This will be in its own template (eg, search/results) wrapped in the site’s header and footer.
For usability we could include the search box again (with the search term filled in):
{!-- your page header --}
{exp:search:simple_form weblog="{my_weblog}"}
{/exp:search:simple_form}
Before displaying the results:
<p>Searching for: <b>{exp:search:keywords}</b> found {exp:search:total_results} results.</p>
{exp:search:search_results}
- {title}
- {excerpt}
This will display the search results in a simple, definition list.
Comments
Related articles
- FeedGrab and CSVGrab now multiple site compatible
- Setting up an ExpressionEngine Opensearch plugin
- CSVGrab ExpressionEngine plugin
- ExpressionEngine FeedGrab plugin tutorial
- Akismet extension for ExpressionEngine
- FeedGrab ExpressionEngine plugin
Most recent articles
- FeedGrab and CSVGrab now multiple site compatible
- Rejigging brandnewbox
- Safari 3 beta launched for OS X and Window
- Spot the difference
- Setting up an ExpressionEngine Opensearch plugin
1. Sue Crocker
13th Jun 2007 at 7:57 am