In PHP, is there a way for a page to determine where it is in a site's directory structure?
November 4, 2005 7:33 AM
Subscribe
In PHP, is there a way for a page to determine where it is in a site's directory structure? I'm new to PHP, and I want to create an include that will contain my global navigation. The problem I'm having is that I can't figure out how to do that with relative URLs since the include could be written to a page in any of several directory levels. I'm sure this is a solved problem, there's probably even a built in function, but danged if I can find it. So 1, How do I have PHP build my relative URLs based on where they come up in a site's directory path? And 2, where do I go in the future to find this kind of stuff out for myself?
posted by willnot to computers & internet (21 comments total)
posted by twiggy at 7:44 AM on November 4, 2005