glennn.php Posted July 28, 2010 Share Posted July 28, 2010 i know how to get my current directory, and the root path, but what i'm needing to do is find the levels of the current dir, for instance, if i'm in: domain.com/folder1 or if i'm in domain.com/folder1/folder2 or if i'm in domain.com/folder1/folder2/folder3 can someone help? thanks much GN Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted July 28, 2010 Share Posted July 28, 2010 Have a look at getcwd(), it's probably what you need. Quote Link to comment Share on other sites More sharing options...
glennn.php Posted July 28, 2010 Author Share Posted July 28, 2010 that's what i'm using, but that returns the entire server path: /home/content/n/j/l/njlieman/html/dir1/dir2/dir3 where i'm trying to get whether i'm dir1 or whether 2 or 3 - what i need is how deep i am below the root (html, or domain.com) Quote Link to comment Share on other sites More sharing options...
glennn.php Posted July 29, 2010 Author Share Posted July 29, 2010 that's what i'm using, but that returns the entire server path: /home/content/n/j/l/njlieman/html/dir1/dir2/dir3 where i'm trying to get whether i'm dir1 or whether 2 or 3 - what i need is how deep i am below the root (html, or domain.com) figured it out. i just tested for an existing file in another folder... if (file_exists(file.php)) { i'm in root/ } elseif (file_exists(../file.php)) { i'm in root/folder1/... } easy. solved. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.