LemonInflux Posted December 2, 2007 Share Posted December 2, 2007 I have an index.php page. It includes /folder/page.php. In page.php, it includes functions.php. However, to include it in index.php, I have to put /folder/functions.php, not just functions.php. Is there a way that if I include my file, all the include paths on the included file stay the same? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted December 2, 2007 Share Posted December 2, 2007 Put all the files in the same directory Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted December 2, 2007 Author Share Posted December 2, 2007 I can't. Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted December 2, 2007 Author Share Posted December 2, 2007 Let me explain a bit more. I'm creating a forum that can be integrated. The way I'm doing this, is creating it so that you can have one include, and the rest is sorted in the backend. The only problem is, this could be included anywhere on the site, in subfolders or whatever. So, I couldn't have them all in the same folder. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 2, 2007 Share Posted December 2, 2007 Form an absolute file system path using $_SERVER['DOCUMENT_ROOT'] - Â include($_SERVER['DOCUMENT_ROOT'] . "\path_to_file\your_include_file.php"); Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted December 2, 2007 Author Share Posted December 2, 2007 but I won't know the path. That's the thing. They include it. That's the only time. I don't know if it's in a folder called forum/ or i/like/stuff/ Quote Link to comment Share on other sites More sharing options...
tippy_102 Posted December 2, 2007 Share Posted December 2, 2007 You could do something like this: <?php $site_root = "../"; include $site_root."folder/page.php"; ?> Quote Link to comment Share on other sites More sharing options...
LemonInflux Posted December 2, 2007 Author Share Posted December 2, 2007 is that the only way to do it? :/ 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.