Re: include
| From: | Toby Miller | Date: | Fri, 20 Apr 2001 21:34:01 +0000 |
| Subject: | Re: include | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-6934@lists.php.net to get a copy of this message | ||
This is extremely unfortunate as I don't know of a way to do this either. I
do however have a workaround that's not too tedious.
Insert the following code into the very top of all of your documents:
$GLOBALS["DOCUMENT_ROOT"] =
preg_replace("/wwwroot.*$/i","wwwroot",$PATH_TRANSLATED);
This assumes that your root web folder is wwwroot. Change this as necessary.
This enables you to include files like so:
include_once($DOCUMENT_ROOT."/includes/main_header.inc.php");
By the way, $DOCUMENT_ROOT is an Apache environment variable so if you
happen to be running Apache instead of IIS just leave out the preg_replace
call because $DOCUMENT_ROOT will already be set for you.
--Toby
----- Original Message -----
From: "Olivier Botineau" <obotineau@noos.fr>
To: "PHP Windows list (Adresse de messagerie)" <php-windows@lists.php.net>
Sent: Friday, April 20, 2001 6:05 PM
Subject: [PHP-WIN] include
> Good evening all,
> do you know if its possible to give an absolute path instead of a relative
path for include:
> include( '../../menu.php' ); is OK
> incude( '/inculde/menu.php' ); is Not OK
>
> Depend where im in tree directory i have to change '../', then relative
path
> is not usefull in that case.
> (ASP allows this in include directive with VIRTUAL parameter, so I suppose
> PHP too?)
> Olivier.
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net
> For additional commands, e-mail: php-windows-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>