Hello, how do you do...
I have a little problem which i want to fix if its possible..
the search results template has this 2 tags:
The first works fine, but the second one, instead of taking me to a custom screen that explain the search error result, takes me to a movabletype screen...
This is Movabletype 4.2, in the previous 4.0 version, this feature worked well
Maybe you have an idea of how to solve this issue.
Regards
Your example got chewed up. Repost without < and >?
ok,sorry, here goes:
mt:NoSearchResults
and
mt:NoSearch
I just read through some of the MT code, and I think I know what the issue is here. There is a line in MT/App/Search.pm that causes mt-search.cgi to error out if it has no search query terms. It would appear that NoSearch and NoSearchResults don't really do much right now, based on what I saw in Template/ContextHandlers.pm, which is why NoSearch just craps out the moment that no terms are present.
Looks to me like this needs to be submitted as a bug (which I'll do).
Thankyou for the answer Mike, is it possible to repair or delete this lines? or I need to wait until next version?
You'll probably be better off waiting for them to respond to the bug report.
Thanks again, regards
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 <mt:searchstring> evaluates to an empty string, i.e., whether it has a single alphanumeric character in it. You’d do this by using a regular expression in <mt:if>, so:
The logic is this:
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:
Hello Gautam, Thankyou for answer.
I tried to apply the code, without luck, the same message appears...
I would like to paste the SearchResults template adapted here, but I don“t know why the code is not shown properly
maybe I could send you a file by email...
regards