I'm finding the search results on MT4 to be a little lacking and I was hoping to set up something like a KeyMatch where if a users puts in a search string that I anticipate (e.g. "news") then I can display the page that I want them to go to above the regular search results.
I tried to do this using an MTIF statement with the tag SearchString, but it didn't seem to work. If I set
Movable Type would ignore the IF statement and publish the conditional statement regardless of the search string.
<mt:If tag="SearchString" eg="news">
any suggestions?
thanks,
Andrew
Reported on Movable Type 4.3
You misspelled the operator in the If tag.
oops. thanks.
Can you set "eq" to more than one thing?, like:
obviously not exactly like that but something that will get the same result.
No. At that point, you should just be using the like operator instead.
How does like work? All it says in the documentation is:
"Tests whether the given value matches the regex pattern in the 'like' attribute."
How, for example, can I get the if statement to be operable if user searches on "news", "News", "events", "Events", "event" or "Events"?
thanks
There's not much more to say about it than that.
If you need an actual example, it's used in a few of the snippets further down. That tag's just got too many possibilities to stick one between each argument; the page would become unusable. You'll find the mt:EntryAuthor example especially interesting.
If it's the regular expression part that's a problem, you've got some research to do, unfortunately. This might be a good place to start.