<mt:NoSearch>
A container tag whose contents are displayed only if there is no search performed.
This tag is only recognized in search templates.
This page was last updated on 1969-12-31, 16:00. [Edit]
A container tag whose contents are displayed only if there is no search performed.
This tag is only recognized in search templates.
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.
Copyright 2007-2009 Six Apart Ltd. All content licensed under Creative Commons Attribution-Share Alike 3.0 Unported License.
Gautam Patel
September 12, 2009 11:30 AM | Reply
There's a problem with this tag in version 4.2+. See the forum thread and fogbugz.
It seems nosearch doesn't do very much in this release, and the fix is scheduled for integration into the next.
Meanwhile, you can actually use the <mt:if>, <mt:else>, <elseif> and <mt:unless> conditional tags to get this to work.
Basically, you run <mt:if> to test whether the search string evaluates to an empty string, i.e., whether it has a single alphanumeric character in it. You do this by using a regular expression in <mt:if>, so:
The logic is this:
a. show the results if any are found; or
b. show no results found for that string;
Finally, if <mt:searchresultcount> evaluates to zero (there are no search results; which is true whenever nothing is found and also when nothing is specified to find), display instructions.
Example: