includes linking to other files, help with relatives
| From: | Allen McCabe | Date: | Mon, 07 Dec 2009 05:47:30 +0000 |
| Subject: | includes linking to other files, help with relatives | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-300262@lists.php.net to get a copy of this message | ||
I am creating a database connection path that check for a session variable
to get the username, password, dbname, etc., but if the session has not been
set yet, I need my script to get those values from another file
(KEY.txt) where they are saved. I want to access this class from two
directories, and this text file (KEY.txt) is in a directory above both. Like
this:
root: folder1 - folder2
folder1: KEY.txt
folder2: index.php - database.php - folder3
folder3: index.php
I need to use database.php in both index files, but database.php references
KEY.txt. So my question is, do I have to check which directory the calling
script is in (ie. which index.php file is using database.php) and add the
according up directory references, or do I need to use some kind of
$_SERVER[DOCUMENT_ROOT]
thing?
Any help would be appreciated!