RE: [PHP] nested includes()...
| From: | Tim Ward | Date: | Tue, 09 Oct 2001 13:46:04 +0000 |
| Subject: | RE: [PHP] nested includes()... | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70467@lists.php.net to get a copy of this message | ||
----------
From: Dave Watkinson [SMTP:d.watkinson@mightymatch.com]
Sent: 09 October 2001 11:59
To: Kamil Nowicki; php-general@lists.php.net
Subject: RE: [PHP] nested includes()...
I had something like that ... one include file for all my database
functions and another included in there for the database connection
info.
Eventually I found I had to use absolute paths (on Win2K) starting
at
d:/<etc>
I do this in windows, but use system variables (e.g. $DOCUMENT_ROOT) for
future proofing. I'm hoping this will help if I ever get a proper (i.e.
Linux) server. I'm writing to Santa ...
Tim Ward
HTH!!
Dave
-----Original Message-----
From: Kamil Nowicki [mailto:hilarion@elfin.pl]
Sent: 09 October 2001 11:55
To: php-general@lists.php.net
Subject: Re: [PHP] nested includes()...
> I have a file x.php that includes a.inc, and a.inc includes
b.inc...
>
> if I have a file dir/z.php including ../a.inc it doesn't work cuz
it
won't
> find b.inc...
>
> how can I get around this???
in file dir/z.php do:
<?
chdir( ".." );
include( "a.inc" );
chdir( "dir" );
?>
This way all included files have proper current working
directory and are able to include anything else (not depending
on above 'dir' directory structure, so it's movable structure).
The only problem is that 'z.php' has to be aware that it's in 'dir'
directory.
Kamil 'Hilarion' Nowicki
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail:
php-list-admin@lists.php.net