Hello, horseradish:
I had the same problem a long time ago, I needed to mix PHP and SSI
directives and after perform some research I came to the conclussion
that it's not possible, at least, in the strict meaning of the phrase.
The reason is simple, it's the way the webserver works:
-When you call a CGI (PHP, Perl, etc), the webserver executes the
program in the server
-That program produces some output
-That output it's directly echoed to the client's browser, that is,
it's not processed again by the webserver looking for SSI directives
This doesn't mean you can't mix CGI with SSI includes, but maybe you
have to look in reverse, that is, call the CGI from the HTML page
using SSI, of course, this is not what are you looking for, but I
include it as extra information.
Apache Tutorial: Introduction to Server Side Includes
http://httpd.apache.org/docs/howto/ssi.html.html
You can execute a CGI and dump the results into the page using SSI:
<!--#include virtual="/cgi-bin/counter.pl" -->
On the other hand, you can *emulate* in your CGI the way SSI works if
the SSI command it's simple, for example, include another document, or
just call any other CGI, if you want to elaborate more on this
direction, please, request for a clarification.
Also, if you use Apache, you can perform an apache subrequest to
emulate the SSI command, if you want to elaborate more on this
direction, please, request for a clarification.
These are some references to the same problem of yours:
I am having trouble using SSI(Server side includes) from cgi using
perl
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=E693DE68445C064FA112BAFE0A5EFD25012B3528%40exchange.nj.aptegrity.com&rnum=7&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dserver%2Bside%2Bincludes%2Bcgi%26btnG%3DGoogle%2BSearch
Apache: can cgi output be parsed for Server-side includes?
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=Dp5LwE.7I%40uns.bris.ac.uk&rnum=8&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3Dserver%2Bside%2Bincludes%2Bcgi%26btnG%3DGoogle%2BSearch
In software, it's very difficult to find something that cannot be
done, the problem is to find the way to achieve the same results in
another way, so if you want to continue investigating, maybe we can
find a way to get your job done.
Search strategy
server side includes cgi
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=server+side+includes+cgi&btnG=Google+Search
Regards. |