« My Sage RSS Feed Broke | Main | Hacking Thingamablog's Database »

Sunday, August 09, 2009

I Created an Internal Site Search Engine

I have written a search engine to search just this blog for text strings. Previously I had posted a site search which used Google, but that searches my entire domain name, thekimerers.com. What I wanted was a search engine that will search only this blog. Besides, it took a month for the Google bots to find this blog so it's search engine was useless during that time.

So I wrote my own. Since I changed my web page type from .html to .php I can now write programs in php to do whatever I want. And that is what I did.

I wrote a program to search this site and called it "tamb_search.php". Click here to view the program.

The program is invoked from a form on the main page. I posted it to the main page by adding a new custom tag called "PhpSearch". The text in that tag is the following:

<div class="sidetitle">Internal Site Search</div>
<div class="side">
<center>
<table border="3" align="center" CELLPADDING="10">
<tr><td align="center">
<form action="tamb_search.php" method="post">
<input type="text" name="pattern" /><br><br>
<input type="submit" value="Search Thingamablog Blog"/>
</form>
</tr></td>
</table>
</center>
</div>  

When you enter a search value and click on the button, it takes you to a new page with the search results and another form to do another search. The form on the page tamb_search.php is self-referential, meaning that it posts to itself, so you can keep searching from the same page as many times as you like.

Posted by Brian S. Kimerer at 8:21 PM

This site and all of its contents are copyright Brian S. Kimerer 2009