|
-
Feb 15th, 2005, 06:22 PM
#1
Thread Starter
Ex-Super Mod'rater
Keeping track of DIRs when Including scripts. -[RESOLVED]-
Whats the best way to keep track of what Directory you are in when including files.
For example I have the script being run: /index.php
But inside it it will include a file /inc/user.inc.php
Then inside that file it wants to include /inc/error.inc.php
Kinda simple apart from if I include /inc/user.inc.php into the file /admin/index.php then the line inside /inc/user.inc.php that includes the error include will be wrong, because its a relative include.
I must use relative includes because I want this to be able to run on different servers and they may not be hosting from the same DIR.
I had a thought of having a variable in every script that will hold which DIR it is in but didn't know if that was tacky. Also if the files were moved to another DIR this falls down. What is the easy way to determine the DIR the script is being run from relative to the Hosting DIR.
Thanx
Last edited by Electroman; Feb 16th, 2005 at 06:39 PM.
When your thread has been resolved please edit the original post in the thread (  )
and amend "-[RESOLVED]-" to the end of the title and change the icon to  , Thank you.
When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|