Apache::ASP #include file, relative filenames
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"-- If I access http://.../series/slayers/lina/index.inc, then it will do the first include correctly. But in the second include, it resolves the path name relative to /series/slayers/lina/ instead of /series/slayers/, so it ends up including /series/slayers/index.inc instead of /series/index.inc. I worked around this by doing "PerlSetVar IncludesDir /home/goamembers/www" (which is my DOCUMENT_ROOT), and then using includes such as: !--#include file="/series/slayers/index.inc"-- !--#include file="/series/slayers/lina/index.inc"-- -Philip Mak ([EMAIL PROTECTED])
Re: Apache::ASP #include file, relative filenames
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.com1-714-625-4051