Unified Search Part 2

The one problem with my Unified Search for blog entries and photos was it always hit the blog search engine and page before redirecting to photo searches. I found the magic solution in PHP’s header command, which allowed me to direct searches though a pre-search page that redirects transparently. Here’s the code:

$PARAM = array_merge($_GET, $_POST); 
$s = $PARAM['s']; # search terms
$search_type = $PARAM['type'];  # search type

if ($search_type == “photos”) {
  header(”Location: http://www.botos.com/
cgi-bin/tag_search.cgi?terms=$s”);
} else {
  header(”Location: http://matthewbotos.com/?s=$s”);
}

No Responses to “Unified Search Part 2”

Leave a Reply