codexx Posted March 27, 2007 Share Posted March 27, 2007 Hey Everyone, I have a functions file in my /home folder. My web directory in /home/public_html/ . I have a header file in /home/public_html/assets/includes/header.php . The top line on the header.php is <?php require("../../databases.inc"); ?> The problem is that whenever I include my header in a folder (ie. /home/public_html/videos/index.php) it will not get the databases.inc file as its now looking in public_html instead of my /home folder. Is there any function in the $_SERVER functions or anything simliar to detect how many folders it has to navigate to inorder to find the functions file? Quote Link to comment Share on other sites More sharing options...
ToonMariner Posted March 27, 2007 Share Posted March 27, 2007 <?php require($_SERVER['DOCUMENT_ROOT'] . '/../databases.inc"); ?> that should connect no matter where you put the code. Quote Link to comment Share on other sites More sharing options...
codexx Posted March 28, 2007 Author Share Posted March 28, 2007 Thanks for the response! I tried that out but it doesn't seem to be finding the file, the folder that it is trying to look in is.. /home/*username*/public_html/beta/../databases.inc Quote Link to comment Share on other sites More sharing options...
codexx Posted March 28, 2007 Author Share Posted March 28, 2007 My mistake, forgot about the "beta" folder. Just had to change it to ../../../ .. Thanks alot 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.