Hi Tom,

There are a couple obstacles in your path, all of which are
surmountable.  I guess the root of the problem is that you want SSI to
work, but you don't want to use SSI to insert the footer.  Since that's
probably not a very common situation, I'm not sure this ground has been
tread before.

First, I'll need to modify Apache::SSI so that its output can be
filtered via Apache::Filter.  Currently it can filter others' output,
but its output can't be filtered (it has to be last in the chain).  This
change has been on my TODO list for a long time though, so I guess it's
about time I did something about it.  Try version 2.16_01 at
http://forum.swarthmore.edu/~ken/modules/archive/ .  It contains a new
Apache::FakeSSI module that's just a simple subclass of Apache::SSI, the
only change being that it doesn't do a full-blown subrequest for
includes, it just opens the file and handles it itself.  (Subrequests
can't be filtered, Apache sends them straight to the browser.)

Note that Apache::FakeSSI <!--#exec cgi="..."--> doesn't work yet with
2.16_01.

Second, Apache::Footer will need slight changes to work with
Apache::Filter.  I'm not sure whether there's an official place to
submit patches to the book code or not, but the following patch should
get you going:

===================================================================
--- Footer-orig.pm      Mon Jan  8 00:15:20 2001
+++ Footer.pm   Mon Jan  8 00:20:01 2001
@@ -6,6 +6,7 @@
 
 sub handler {
     my $r = shift;
+    $r = $r->filter_register() if lc($r->dir_config('Filter')) eq 'on';
     return DECLINED unless $r->content_type() eq 'text/html';
 
     my $file = $r->filename;
@@ -22,9 +23,15 @@
     my $modtime = localtime((stat _)[9]);
 
     my $fh;
-    unless ($fh = Apache::File->new($file)) {
-       $r->log_error("Couldn't open $file for reading: $!");
-       return SERVER_ERROR;
+    if (lc($r->dir_config('Filter')) eq 'on') {
+       my ($status);
+       ($fh, $status) = $r->filter_input();
+       return $status unless $status == OK;
+    } else {
+       unless ($fh = Apache::File->new($file)) {
+           $r->log_error("Couldn't open $file for reading: $!");
+           return SERVER_ERROR;
+       }
     }
     my $footer = <<END;
 <hr>
===================================================================

Finally - I noticed that you're subclassing Apache::SSI, but I'm not
sure why you'd need to do that unless you need additional functionality
that you haven't mentioned.

[EMAIL PROTECTED] (Tom Kralidis) wrote:
>
>If you recall, I've added an Apache::Footer to each page of type .htm|.html. 
>  I'm trying to get this done with .shtml pages as well.

  -------------------                            -------------------
  Ken Williams                             Last Bastion of Euclidity
  [EMAIL PROTECTED]                            The Math Forum

Reply via email to