This snippet is intended to search for terms sent from a HTML form. An example is below, which you are free to use. It should be included in either your template(s), or a chunk for inclusion in a variety of templates. Note that you will have to change the two instances of <docid> to the document id of the search results page on your site.
Note that the search form is just a HTML form. No snippet call is required to generate a form. The snippet call appears only on the results page template.
Because a snippet call is not used to generate the form, the form can be modified without any more knowledge than that of knowing HTML.
Suggested search form
Note that I use "get" rather than "post" so that if someone bookmarks the search results the search terms will be bookmarked (post parameters do not appear in URLs).
<div id="nav-search"> <form action="[~<docid>~]" method="get"> <div> <label for="searchTerms">Search Terms</label> <input id="searchTerms" name="searchTerms" type="text" /> <input type="hidden" name="id" value="<docid>" /> <input class="button" id="search" name="search" value="Search" type="submit" /> </div> </form> </div>
Note that the hidden input is only required for unfriendly URLs, but its presence will not break friendly URLs.
MODx Revolution
Version 2.0 of the code is suitable for both all recent versions of Evolution and Revolution 2.0 (2.1 compatibility as yet uncertain). It is essentially the same code, just with changes as required for the different Revolution API.
You will need to use a form similar to the following. Substitute the resource id of your search results page for the '6' below.
<div id="nav-search"> <form action="[[~6]]" method="get"> <div> <label for="searchTerms">Search Terms</label> <input id="searchTerms" name="searchTerms" type="text" /> <input type="hidden" name="id" value="6" /> <input class="button" id="search" name="search" value="Search" type="submit" /> </div> </form> </div>
Note that everything else remains the same. Placeholders used by this snippet are exactly the same in Revolution as in Evolution e.g. [+mytemplatevariable+] is still [+mytemplatevariable+].