m1k3yb0y Posted November 19, 2011 Share Posted November 19, 2011 Hey guys! I am using xampp 1.7.7 usb edition for my php server and I am trying to include a php file that's different from where I have all my php files at. I have them in: \xampp\htdocs\xampp\RecipeSite. Is there a certain path I should use instead of <?php include('/xampp/splash.php'); ?> to allow for xampp to pick up my file? I appreciate your solutions guys. Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/ Share on other sites More sharing options...
trq Posted November 19, 2011 Share Posted November 19, 2011 Is htdocs your server document root? Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1289449 Share on other sites More sharing options...
m1k3yb0y Posted November 19, 2011 Author Share Posted November 19, 2011 yep. Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1289454 Share on other sites More sharing options...
trq Posted November 19, 2011 Share Posted November 19, 2011 Then use: <?php include $_SERVER['DOCUMENT_ROOT'] . '/xampp/splash.php'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1289459 Share on other sites More sharing options...
m1k3yb0y Posted November 21, 2011 Author Share Posted November 21, 2011 Thanks man! It worked! Now it is not detecting the splash image file. What do I use path wise? Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1290191 Share on other sites More sharing options...
PFMaBiSmAd Posted November 22, 2011 Share Posted November 22, 2011 it is not detecting the splash image file. By 'it' I assume you mean the browser (browsers request and render the media files on a web page.) Are you using a valid web accessible URL to the splash image file in the HTML markup on your page? You can either use a fully qualified URL - http://somedomain/some_path/some_file.ext (the browser uses the URL directly) or a domain root relative URL - /some_path/some_file.ext (the browser appends the given URL to the domain of the current page) or a (page) relative URL - ../some_path/some_file.ext (the browser appends the given URL to the URL of the current page.) Don't confuse URL's (that browsers use to make HTTP requests for files) with file system paths (that php uses to include files on the server.) Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1290375 Share on other sites More sharing options...
m1k3yb0y Posted November 22, 2011 Author Share Posted November 22, 2011 The image below tells you what I was talking about. Here's the code that shows what the image shows.... [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1290566 Share on other sites More sharing options...
PFMaBiSmAd Posted November 23, 2011 Share Posted November 23, 2011 Cannot help you without the code that is responsible for the symptom. Someone already posted the three possible types of URL's to use. It is up to you to make sure that each element in the type of URL that you are using is correct. Usually, the path to the image is incorrect. Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1290753 Share on other sites More sharing options...
m1k3yb0y Posted November 23, 2011 Author Share Posted November 23, 2011 Sorry I forgot to post the code. >.< Here it is: <html> <body> <?php include $_SERVER['DOCUMENT_ROOT'] . '/xampp/splash.php'; ?> <?php include('header.inc.php'); ?> <br><br> <h2>This is the body of the main page</h2> <?php include $_SERVER['DOCUMENT_ROOT'] . '/xampp/manuals.php'; ?> </body> </html> Where do I place the url link at on the code? Quote Link to comment https://forums.phpfreaks.com/topic/251409-need-some-help-with-the-include-statement-on-xampp-177/#findComment-1290793 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.