Well, I finally got the MT Search into a PHP Template, thanks to some help from Michael Simmons, of thoughtanomalies.com. He has a wonderful working script that you can just plop in and use. I made a few minor modifications, and that was all she wrote.
The basis for his script is to turn the default template for the MT Search into an XML document. Not a well-formed XML document, but a singular instance that is used only by this script. At some point I'd like to make that a well-formed XML document, but I'm not sweating it now.
Then you use his nicely written search document that reads in this XML document. Bingo! You have a PHP search.
I did modify the search string to include both of the blogs I was running (Blog-Fu and Link-Fu). This was done by modifying the file declaration from http://YOURSITE/PATH/TO/MT/mt-search.cgi?&IncludeBlogs=2.... to http://YOURSITE/PATH/TO/MT/mt-search.cgi?&IncludeBlogs=1&IncludeBlogs=2..... By adding in another URL String of the IncludeBlogs= with the other BlogID, I can search multiple blogs in one search result.
I also was running into problems using the fread function. So I switched that function to file_get_contents, and that problem went away.
Lastly, because I didn't have individual archives set up for the Link-Fu entries, I wanted to display those differently. After monkeying around with the search results, I realized that rather than extend the XML document, and the search results page, I needed some sort of archives for the sidebar links. So I just created monthly archives, and that worked out great as well.
This was by far and away the easiest implementation I found of switching the searching over to PHP. I highly recommend using Michael Simmons method.
Comments are Open (0)
Posted at 07:31 AM