SearchAltTemplate

This configuration directive specifies alternative search templates which can be specified in a search form in the published site. SearchAltTemplates may be required if publishing multiple weblogs or if alternate versions of your search results are desired.

You can specify more than one SearchAltTemplate in the configuration. However, that specifying SearchAltTemplate in the configuration overwrites the default value. To add search templates, you must specify the default value in the configuration as well.

Additional search templates should be added on the file system to $MT_HOME/search_templates

Default: feed results_feed.tmpl

Example

SearchAltTemplate feed results_feed.tmpl

(This the default behavior)

Usage

This example sets up the alternate template for the "work" and "comment" search in addition to the default feed search.

SearchAltTemplate feed results_feed.tmpl
SearchAltTemplate work work.tmpl
SearchAltTemplate comment comments.tmpl

To use the "work" template, place this line:

<input type="hidden" name="Template" value="work">

...in the search form like this search (simplified example form):

<form method="get" action="<$mt:CGIPath$><$mt:SearchScript$>">
    <input type="hidden" name="Template" value="work">
    <input type="text" name="search" value="<$mt:SearchString$>" />
    <input type="submit" value="Search" />
</form>

This directive was introduced in version 4.2. This directive deprecates AltTemplate directive. The purpose and the behavior of the two directives are exactly the same.

This page was last updated on 2011-04-27, 02:32.

2 Notes

Example:

Added to mt-config:

SearchAltTemplate globalsearch globalsearch.tmpl

Added template:

/search_templates/globalsearch.tmpl

URL to access script using "Template" parameter

/cgi-bin/mt/mt-search.cgi?limit=20&Template=globalsearch&search=foo

Search Form input:

I've answered a user question on the forum on this topic about the place where the configuration directive:

SearchAltTemplate something something.tmpl

should be set.

This configuration directive, as any other config directives should be placed inside the mt-config.cgi file.

You will then have to upload this mt-config.cgi file to the server mt cgi-bin folder in ASCII mode.

Enjoy, Mihai Bocsaru

Daily Movable Type Consultant

Web Development - Movable Type Consulting - Six Apart Partner http://www.pro-it-service.com/

Movable Type Demo http://www.movabletypedemo.org/

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.