General Purpose Search Template

February 28, 2003 - updated February 8, 2006

The default search template does not remember custom settings, such as LimitBlogs. Although MovableType allows you to specify alternate search templates for specific searches, the default template would often suffice, if only it would remember those custom settings such!

MoveableType allows you to be quite flexible when specifiying search forms. Beside the search string that you’re searching for, you can also specify which blog(s) to search using the IncludeBlogs settings, how to order the search results using the ResultDisplay setting, etc. However, the default search template that ships with MovableType has the drawback that it does not preserve the settings with which you invoked it. So although you may have specified "LimitBlogs=1" in your initial search, if the user does another search from the search result page, all blogs will be searched (as globally configured in mt.cfg).

You can design a general purpose search template using the MTCgi plugin which will remember the custom settings that it was invoked with:

  1. Download and install the MTCgi plugin inside your MovableType/plugins directory.
  2. Edit the default search template, default.tmpl, located in the MovableType/search_templates directory by adding the following code inside the <form> tag:
    <MTCgiParams name="IncludeBlogs,ExcludeBlogs,Template,SearchElement,SearchSortBy,ResultDisplay,SearchCutoff,MaxResults">
    <input type="hidden" name="<$MTCgiParamName$>" value="<$MTCgiParamValue$>">

Follow these directions if you also want to have your search results displayed on multiple pages.