I want to customise the results page to fit the look of my site. My site's pages use two include files, header.ssi and footer.ssi. Perfect Search has a search.html template that I have edited to include these files and it looks ok when previewed locally.
However, when run on the server the header and footer includes aren't recognised i.e. I can see the include statement in the source code. Are there any CGI gurus that can point me in the right direction to fix this?
I could substitute the includes for the actual HTML code if I had to but that sort of defeats the purpose of include files, doesn't it? :).
Server Side Includes are parsed by the server when read from a .shtml file. However, when output is generated by a CGI script, it is not parsed by the server in this fashion, so the SSI calls aren't recognized by the server.
Instead of using SSI calls, you could edit the CGI script and have it read the same file the SSI did and insert it into the results. Here's a couple of lines you could insert that would accomplish this:
use LWP::Simple;
$SSIheader = get "http://www.yourdomain.com/cgi-bin/header.cgi";
$SSIfooter = get "http://www.yourdomain.com/cgi-bin/footer.cgi";
print $SSIheader;
print $SSIfooter;
These lines could be used to execute the cgi-script that would normally be called by the SSI call. You would replace the SSI calls with these lines. Note that this would go into the search CGI script itself, not into any template that script used.
>>Now I'm confused - shouldn't this be domain.com/header.ssi?yes
I´m not quite sure about this definite yes. While the LWP::Simple [search.cpan.org] pod page does not say so explicitly I do believe that get [search.cpan.org] expects absolute URIs. Only when using SSI the authority part of the URI is not allowed.
Andreas
LWP::Simple expects absolute URLs.
When I put that example URL in there, I thought you were using SSI to call a CGI script that generated the header. If you are simply including the contents of a text file, then you would call that text file directly, so it would have to point to header.ssi