Mikangakang Posted May 8, 2010 Share Posted May 8, 2010 To preface this; I have very little php and website experience, so please bear with me. What I'm trying to do is a (hopefully) simple php_include for the header, menu, and footer of my portfolio website. I'm using GoDaddy, which google has now told me does PHP in a really strange fashion. EDIT: Okay, I fixed one problem, and since nobody has replied, I'm just going to edit this one topic. The code I have is this: <?php include ("http://mikholmes.com/phpinclude/topchunk.php"); ?> Site Content <?php include ("http://mikholmes.com/phpinclude/bottomchunk.php"); ?> The errors I get are this: Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/content/m/i/k/mikholmes/html/testphp.php on line 1 Warning: include(http://mikholmes.com/phpinclude/topchunk.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/content/m/i/k/mikholmes/html/testphp.php on line 1 Warning: include() [function.include]: Failed opening 'http://mikholmes.com/phpinclude/topchunk.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/m/i/k/mikholmes/html/testphp.php on line 1 Site Content Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/content/m/i/k/mikholmes/html/testphp.php on line 6 Warning: include(http://mikholmes.com/phpinclude/bottomchunk.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/content/m/i/k/mikholmes/html/testphp.php on line 6 Warning: include() [function.include]: Failed opening 'http://mikholmes.com/phpinclude/bottomchunk.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/content/m/i/k/mikholmes/html/testphp.php on line 6 Now, it no doubt has something to do with that pesky "url file access is disabled." How can I directly access my /phpinclude/ folder with pages in other folders? Link to comment https://forums.phpfreaks.com/topic/201128-likely-simple-include-question-godaddy/ Share on other sites More sharing options...
chrismarsden Posted May 9, 2010 Share Posted May 9, 2010 try using just the file location without trying to use the whole url: <?php include 'phpinclude/topchunk.php'; ?> Link to comment https://forums.phpfreaks.com/topic/201128-likely-simple-include-question-godaddy/#findComment-1055212 Share on other sites More sharing options...
Mikangakang Posted May 9, 2010 Author Share Posted May 9, 2010 try using just the file location without trying to use the whole url: I considered trying this, but due to assignment requirements (this is for a class assignment btw), I need to have different pages in different folders. So if I have /mik/etc1/whatever.php /mik/etc2/whatever2.php how can I make both include /mik/phpinclude/whatever without specifying the URL? HOWEVER, I did some googling, and added <?php set_include_path( get_include_path() . PATH_SEPARATOR . $_SERVER['DOCUMENT_ROOT'] ); ?> to the top of my php pages, and I think it works. I've yet to try it out fully in multiple pages, but from this forum's experience and opinion, is this a good idea? Link to comment https://forums.phpfreaks.com/topic/201128-likely-simple-include-question-godaddy/#findComment-1055215 Share on other sites More sharing options...
chrismarsden Posted May 9, 2010 Share Posted May 9, 2010 well this should work just as well i think, as long as they are located in the same html_public folder just specify the folder path from there: <?php include 'mic/ect/whatever.php'; ?> <?php include 'mic/ect2/whatever2.php'; ?> either that or i dont understand the question Link to comment https://forums.phpfreaks.com/topic/201128-likely-simple-include-question-godaddy/#findComment-1055216 Share on other sites More sharing options...
Mikangakang Posted May 9, 2010 Author Share Posted May 9, 2010 Other way around. I want to keep my topchunk.php and bottomchunk.php in the html_public/phpincludes/ folder, while having a bunch of pages in other folders. So if "html_public/games/pages/etcetera/index.html" includes "phpincludes/topchunk.php", won't it say "Can't find /games/pages/etcetera/phpincludes/topchunk.php"? Link to comment https://forums.phpfreaks.com/topic/201128-likely-simple-include-question-godaddy/#findComment-1055217 Share on other sites More sharing options...
chrismarsden Posted May 9, 2010 Share Posted May 9, 2010 just tested it on my localhost server as i wasnt sure but you are right... maybe the key would be keep your website structure simpler lol... other than that all i can say is i tried lmao... hope you find the answer your looking for. Link to comment https://forums.phpfreaks.com/topic/201128-likely-simple-include-question-godaddy/#findComment-1055219 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.