The search form in the upper right now lets you search both blog posts and photos from the front page. This is something I’ve been meaning to do for a long time, but dreaded the thought of having to convert the Perl CGI photo search. Instead, the blog search page now catches the search type and redirects to the photo search if appropriate. Here’s the new code in header.php:
<?php>
$PARAM = array_merge($_GET, $_POST);
$search_type = $PARAM['type']; # search type
if ($search_type == “photos”) {
?>
<meta http-equiv=”refresh” content=”0;
URL=http://www.botos.com/cgi-bin/tag_search.cgi?terms=
<?php echo $s; ?>”>
<?php } ?>
The page is still rendered and displayed before the redirect kicks in, so search.php also got some logic to short circuit rendering the results of the search. WordPress still performs the search, but this it’s reasonably quick and skipping it would require digging into WordPress beyond the template files. Improvements to this little scheme are welcome, or you can use it as-is to extend WordPress with your own search engine.


