MrFish Posted December 20, 2011 Share Posted December 20, 2011 I'm trying to include a php file and dynamically write head tags. My short code looks like this. ob_start();include($path);$page = ob_get_contents();ob_end_clean(); But the file is included and displayed anyway. I've put an exit() after ob_end_clean() because I echo the page contents and I still see everything. Any ideas? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 21, 2011 Share Posted December 21, 2011 Those 4 lines of code wouldn't display the contents. Something else is causing that. It may be due to something in the include file. Link to comment Share on other sites More sharing options...
MrFish Posted December 21, 2011 Author Share Posted December 21, 2011 Any thoughts about what might do it? Another ob_get_clean() ? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 21, 2011 Share Posted December 21, 2011 If the included file turns off output buffering, that would do it. If the included file exits then it will also display everything. Link to comment Share on other sites More sharing options...
MrFish Posted December 21, 2011 Author Share Posted December 21, 2011 Ah you're right! I found in a sidebar include I was trying to use a class that I didn't load. I didn't notice because it would usually break the page but since it didn't inform me I didn't realize. You saved me another hour of rage! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.