Is it possible to do a server-side include such as the following:
<!-- #echo var="LAST_MODIFIED" -->
I've tried it numerous ways and failed every time -- so I figured it was time for a definitive answer. I can certainly live without them but they would be nice to have.
This is done with a server side include that executes a program. To see
this example in action try index.html
.
Here is an example of how to use scripts as server side includes. This
is not a CGI/1.1 program,
but something similar could be done with CGI/1.1. Assuming that the
program "counter.cgi
" is in the same
directory as "foo.html
" put something like:
File=foo.html
Includes=!counter.cgi
in your index
file.
Then put:
<!-- #include -->
on a line with no leading whitespace in the file foo.html
.
The program counter.cgi
gives the current count of accesses
to this page and also prints the last-modified date. It should be easy
to modify for your needs.
There are a couple of permissions issues. The user id under which the
server runs (e.g. "nobody
") must have permission to execute
counter.cgi
and to read and write the file
/tmp/wncount
.
counter.cgi
Here is the perl program: