Not a developer? Go to MovableType.com

Documentation

SearchAltTemplate

This is documentation about a configuration directive, which can be placed within Movable Type’s core configuration file, mt-config.cgi, to customize the behavior of the system.

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.

Back

2 Comments

Beau Smith

Beau Smith on April 1, 2009, 4:40 p.m. Reply

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:

<input type="hidden" name="Template" value="globalsearch">
PRO IT Service

PRO IT Service on April 12, 2010, 3:04 p.m. Reply

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/