elmas156 Posted December 3, 2010 Share Posted December 3, 2010 I have a site that I have the same information on several pages in different folders. Right now I have an include page in each folder and when I need to change the information on the include page, I have to do it for every folder, even though the information is all the same. What I need to do is have one include page that I can modify and all the other pages in the different folders can include it. I know I'm kind of rambling here but I hope I'm making sense. I need to know how to include a file from one folder into a page from another folder. Here's what I've tried so far and it didn't work... not sure what else to try. include("http://www.website.com/include.inc.php"); The file that I'm trying to include this into is located at http://www.website.com/folder1/page.php ... so include("include.inc.php") won't work... I have to specify what folder or directory to pull the include file from. Sorry about the rambling and thanks in advance for any help. Quote Link to comment Share on other sites More sharing options...
elmas156 Posted December 3, 2010 Author Share Posted December 3, 2010 I figured it out! For those of you who may be having the same problem, here's the answer: I have no idea why this isn't working: include("http://www.website.com/include.inc.php"); But... this works fine: include("../include.inc.php"); Basically, for each "../" you put in front of the file name, it goes up one level. So if you're include file is located at "http://www.website.com/include.inc.php" and the page you are including it on is at "http://www.website.com/folder1/folder2/page.php" you would do this: include("../../include.inc.php"); Hope this helps someone. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted December 3, 2010 Share Posted December 3, 2010 If you deal with this often, you might have a look at $_SERVER['DOCUMENT_ROOT'] also. 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.