The only way you're going to get the file interpreted is by feeding it to the server, so yes, a temporary file is a must - whether you put the search results in a file and include it in the templated page (search.php?myhash, where file is named according to myhash) or include the templated page as multiple pieces around the search results (include header.php and footer.php).
Comment on Re: How do I present other web extensions?
Yeah, I see what you mean by the temporary file. I guess a yucky way is to request the temp file using something like LWP from within search.cgi (my search script), capture the result in a variable, remove the temp file and then output the variable... Thanks