leomoon Posted November 22, 2007 Share Posted November 22, 2007 Hi, I was wondering is there any other way to have the same function as include? My server recently disabled include so I can't use that anymore and they told me I can use fopen. I searched on the net but I don't seems to be able to make it work!!! What I want to do is SO SIMPLE. I just want to render a header inside the main php page. What I had before was (to load a menu): <?php include("http://leomoon.net/static/topmenu.html"); ?> Tnx. Waiting for your reply. Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/ Share on other sites More sharing options...
rajivgonsalves Posted November 22, 2007 Share Posted November 22, 2007 if its a static page like the html you mentioned just use the following print file_get_contents("http://leomoon.net/static/topmenu.html"); Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/#findComment-396601 Share on other sites More sharing options...
nuxy Posted November 22, 2007 Share Posted November 22, 2007 You should use require(); It will also rather than just printing out an error, stop execution of the script if the file that had to be included into the script does not exist, or if something is wrong. Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/#findComment-396602 Share on other sites More sharing options...
leomoon Posted November 22, 2007 Author Share Posted November 22, 2007 Tnx for the print thingee, it works. Require does not work. It seems that require and include are the same except require stops rendering the rest when it sees an error. Now for dynamic pages, is there anything like include? Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/#findComment-396605 Share on other sites More sharing options...
GingerRobot Posted November 22, 2007 Share Posted November 22, 2007 You'd have to grab the contents as suggested above, but instead of printing it, you'll need to evaluate it Personally, i'd find another host. Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/#findComment-396611 Share on other sites More sharing options...
rajivgonsalves Posted November 22, 2007 Share Posted November 22, 2007 well just wrote this function not too sure it will work tho havn't got my server to test it let me know function include_custom($strFilename) { $strContent = file_get_contents($strFilename); eval($strContent); return 1; } Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/#findComment-396612 Share on other sites More sharing options...
leomoon Posted November 22, 2007 Author Share Posted November 22, 2007 Thank you so much! Link to comment https://forums.phpfreaks.com/topic/78378-solved-what-to-use-instead-of-include/#findComment-396630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.