954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How do I get the top-of-the-tree directory?

Hi there, I'm trying to get the root directory of my site... But I don't want to edit the dots with slashes every time I make a new page in a directory inside another directory.. Any ideas? Here's an example tree :-)

-/
-/stuff
--/stuff/lol.php
-/lolwut
--/lolwut/cake.php
--/lolwut/pie.php

GigsD4X
Light Poster
31 posts since May 2010
Reputation Points: 10
Solved Threads: 2
 

$_SERVER['DOCUMENT_ROOT'] will give you the root address.

chrishea
Nearly a Posting Virtuoso
1,428 posts since Sep 2008
Reputation Points: 210
Solved Threads: 230
 

Hmm.. It appears that didn't work, so I used $_SERVER["SERVER_NAME"], and it started working! Anyway, thanks for the help :)

GigsD4X
Light Poster
31 posts since May 2010
Reputation Points: 10
Solved Threads: 2
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You