Rodney H. wrote:Drakla: I see what you do. I am lucky, in the sense that if I move a file out of the current directory up one or into a sub-dir, the software/editor will automatically update the links to my included and required files. So, I don't have to worry about that. And, I test a lot locally before moving files to production....
But, cool. May the PHP force be with you...
See Rodney, my software/editor does the same thing, but I'm trying to stop using it, which means i can get rid of the stupid things it does...but it also means i lose some of the nice features.
As metioned on a previous post, I actually do my coding in frontpage. Why? just cause i started using it years ago at a job (when i already coded in notepad), and it has just stuck with me.
The frontpage includes work nicely, and as you said, whenever i want to move a file, it always asks "do you want to update links, blah, blah". And this is helpful.
But on the same note, i'm trying to stop relying on frontpage for certain things including includes and other such things. This is what brought up this problem. And again, not a problem really, as I can simply reference the link by "thinking" about where the page resides on the "domain" and then linking accordingly as such: "../../catalog/blah.php".
When doing this, no matter how you link, you will have to inform the link that blah.php is located within the catalog directory which itself is in the root directory. So what this boils down to, is whether or not we want to put the "extra" effort into making sure we "go back" the appropriate number of directories in order to make it to the root, before we then call a folder. That is where the $SERVER['DOCUMENT_ROOT'] idea came in. I was hoping to use it as such:
<a href="<?php echo $SERVER['DOCUMENT_ROOT'] . '/index.php'; ?">Home</a>
But again, on my local machine, that doesn't work, as $_SERVER['DOCUMENT_ROOT'] apparently does NOT link to http://localhost/ , the ACTUAL root of the server. Rather, it link to the specific c:\path on my hard drive. And this causes problems.
So i was mainly curious if i was doing something wrong with the $_SERVER['DOCUMENT_ROOT'] command and its usage, or if that was just how it worked.
If it is too much trouble, then really, as mentioned, this all boils down to the fact that we were trying to avoid "remembering" how many directories deep we were into the site. This is obviously not that big of a deal. But it woudl make life easier nonetheless.
Jonathan