most efficient way to define site root

Discussion in 'PHP' started by Greg-J, Apr 14, 2006.

  1. #1
    I'm creating a quasi-cms, and I'm trying to determine if I should just call the includes based on whatever directory I'm in (i.e. ../includes/header.php and 1 deeper ../../includes/header.php) which seems like a poor solution, or if there is a global variable, or a simple function that would allow me to determine my site root and toss it in front of my includes.

    Come on Hoff, I know you're out there ;)
     
    Greg-J, Apr 14, 2006 IP
  2. woodside

    woodside Peon

    Messages:
    182
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #2
    the variable: _SERVER["DOCUMENT_ROOT"]

    will give you the root directory.
     
    woodside, Apr 14, 2006 IP
  3. Greg-J

    Greg-J I humbly return to you.

    Messages:
    1,844
    Likes Received:
    153
    Best Answers:
    0
    Trophy Points:
    135
    #3
    Thaaaat's the one. Thank you very much.
     
    Greg-J, Apr 14, 2006 IP