| PHP, MySQL General PHP questions. Or go to our PHPsuexec Forum >> |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread |
|
|
#1 (permalink) |
|
Registered User
Seasoned Poster
Joined in Jun 2003
30 posts
Gave thanks: 0
Thanked 0 times
|
Trying to be more elegant
I'm trying to actually write "real" code again and it is harder than I thought (to many years doing nothing but circuit analysis). A quick question. I want to be able to call a php file no matter where I am in my directory strucutre. Lets call the file mainconfig.php. Of course in this file are tons of variables and paths to files and such so I don't have to keep calling them typing /home/specht/html_public/blah/blah/blah/blah in all my source code.
My quesiton is how do I call a base path to my website. This way, no matter where my site goes, I shouldn't have to go through hell to fix it. BTW, i don't plan on leaving surpass any time soon :1openarms I'm just trying to write a bit better code. -Andrew |
|
|
|
|
|
#2 (permalink) |
|
Surpass Fan
Super #1
Joined in Dec 2003
Lives in NJ
5,057 posts
Gave thanks: 0
Thanked 4 times
|
take a look at documentation on
$_SERVER["PATH_TRANSLATED"] $_SERVER["DOCUMENT_ROOT"] BTW - also you can refer to paths in a relative sense as well for instance if the file is /home/user/public_html/general/coolstuff/myphp.php a reference to general/coolstuff/myphp.php will work just fine IF - the referring file is in public_html but you want something more elegant ![]() |
|
|
|