Definitive way of obtaining the root directory.
Posted: Thu Sep 29, 2011 4:00 am
Hi guys,
I am searching for the definitive way of obtaining the root directory of my app. I need to it to work on localhost and also on ALL platforms, NIX, Windows etc. I would like to do this as I wish to use it to locate all my sub directory files - includes, model etc.
For example, I may have this as my landing page:
http://www.mywebsite.com/index.php
The root directory might be:
html
The index.php might reside here:
html/index.php
... but my includes files might be here:
html/lib/includes
So I would be looking to obtain the root in an absolute kind of way to allow me to string together the includes sub directory in a relative kind of way.
In summary then:
1. How to obtain the root with 100% percent success, all of the time on all platforms.
2. How to string the sub directory together with 100% percent success, all of the time on all platforms.
3. Any comments on this as an approach, also welcome.
Many thanks in advance,
S
I am searching for the definitive way of obtaining the root directory of my app. I need to it to work on localhost and also on ALL platforms, NIX, Windows etc. I would like to do this as I wish to use it to locate all my sub directory files - includes, model etc.
For example, I may have this as my landing page:
http://www.mywebsite.com/index.php
The root directory might be:
html
The index.php might reside here:
html/index.php
... but my includes files might be here:
html/lib/includes
So I would be looking to obtain the root in an absolute kind of way to allow me to string together the includes sub directory in a relative kind of way.
In summary then:
1. How to obtain the root with 100% percent success, all of the time on all platforms.
2. How to string the sub directory together with 100% percent success, all of the time on all platforms.
3. Any comments on this as an approach, also welcome.
Many thanks in advance,
S