Philip Mak wrote:
> 
> On Sun, 21 May 2000, Joshua Chamas wrote:
> 
> > > So, there's no way in Apache::ASP to include a file by specifying a path
> > > relative to DOCUMENT_ROOT, or relative to the directory of the current
> > > file (which is not necessarily equivalent to the request URI, if the
> > > current file is included)?
> >
> > <!--#include file= --> allows relative file specifications.
> > Did it not work for you for some reason?
> 
> It does not work in this kind of situation:
> 
> /series/slayers/lina/index.inc does <!--#include file="../index.inc"-->
> /series/slayers/index.inc does <!--#include file="../index.inc"-->
> 

I see, yes this would not have worked, because Apache::ASP
does a chdir() to whereever the script is.  So what you could
do might be to have a header.inc which does something like...

<% 
  use File::Basename;
  my $dirname = dirname($0);
  $dirname =~ s|^$ENV{DOCUMENT_ROOT}/?||;
  my $up = '';
  for(split(/\//, $dirname)) {
    $up .= '../'; 
    my $include = $up.'index.inc';   
    if(-e $include) {
      $Response->Include($include);
    }
  }   
%>

--Joshua

_________________________________________________________________
Joshua Chamas                           Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com                1-714-625-4051

Reply via email to