Krash Posted February 8, 2011 Share Posted February 8, 2011 Been using these includes in php4 for a long time, but they don't work in php5. Page loads, but included code is blank. <?php include("http://www.xxxxxxxx.org/header.php"); ?> Quote Link to comment Share on other sites More sharing options...
lastkarrde Posted February 8, 2011 Share Posted February 8, 2011 You shouldn't try to include a URL, you should include a path in the filesystem. eg include('path/to/header.php') Quote Link to comment Share on other sites More sharing options...
Krash Posted February 8, 2011 Author Share Posted February 8, 2011 I can use a relative path if the included file is in the same directory or below, but I can't include a file that's above the current directory. Is there a way to do that? Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted February 8, 2011 Share Posted February 8, 2011 Of course there is. You can use $_SERVER['DOCUMENT_ROOT'] to use the path relative to the root of the web server. include($_SERVER['DOCUMENT_ROOT'] . '/path/to/file.php'); Quote Link to comment Share on other sites More sharing options...
Krash Posted February 8, 2011 Author Share Posted February 8, 2011 Yeah, found that and it works fine. If I were a bit younger, and a lot smarter, I'd sit myself down and actually learn this stuff. But if I had some ham, I'd make ham & eggs, if I had some eggs. Thanks! 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.