----- Original Message -----
From: travis forden <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 15, 2001 11:17 AM
Subject: [PHP-DB] includes and filenames
> in effect i want a function that will find the filename of the includer
file and past it into a link.
>
> something like this would appear in the include file.
> $path = filename [this is a function or functions that find the filename
of the file accessing the include file, footer.txt]
> text text text <A href="http://validator.w3.org/check?uri=.$path>text</a>
>
> I want to tack the value of $path onto the end of the first part of the
HREF.
>
> How can I do this?
$HTTP_SERVER_VARS["PATH_TRANSLATED"] or may be just $PATH_TRANSLATED will
give you the name of the parent file. This gives the actual filesystem path
of the parent file. It should be a simple matter of using str_replace to
change this into a URL.
Here's an example from one of my sites (names changed to protect the
innocent):
============================================================================
=============
## Assign the doc path (used instead of $PHP_SELF)
if (strstr($HTTP_SERVER_VARS["PATH_TRANSLATED"],
"/usr/local/apache/htdocs")) {
$DOC_PATH = str_replace("/usr/local/apache/htdocs",
"http://dev.domain.com", $HTTP_SERVER_VARS["PATH_TRANSLATED"]);
$SITE_URL = "http://dev.domain.com"; }
else {
$DOC_PATH = str_replace("/home/www/apache/htdocs",
"http://www.domain.com", $HTTP_SERVER_VARS["PATH_TRANSLATED"]);
$SITE_URL = "http://www.domain.com";
}
============================================================================
=============
I hope the above comes out OK. I'm writing this using Outlook Express <spit>
and it has a tendency to think it knows better and keeps removing the "s
around "http://www.domain.com".
regards
--
Jason Wong
Gremlins Associates
www.gremlins.com.hk
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]