acctman Posted May 17, 2009 Share Posted May 17, 2009 i need to include a php at the bottom of my template but I need for the output to appear in the middle of that page. The reason for this is because the include file uses Global variables that affect any sql coding that is loaded after it. this is what i've been trying but no luck middle of page <?php foo(); ?> bottom of page <?php function foo() { include('forums/newest_posts.php'); } ?> Quote Link to comment Share on other sites More sharing options...
Ken2k7 Posted May 17, 2009 Share Posted May 17, 2009 Have you tried ob_start, ob_get_contents and ob_flush? Quote Link to comment Share on other sites More sharing options...
acctman Posted May 17, 2009 Author Share Posted May 17, 2009 Have you tried ob_start, ob_get_contents and ob_flush? no luck i tried this code middle of page <?php echo $string; ?> bottom <?php $string = get_include_contents('forums/newest_posts.php'); function get_include_contents($filename) { if (is_file($filename)) { ob_start(); include $filename; $contents = ob_get_contents(); ob_end_clean(); return $contents; } return false; } ?> Quote Link to comment Share on other sites More sharing options...
Cardale Posted May 17, 2009 Share Posted May 17, 2009 Have you tried ob_start, ob_get_contents and ob_flush? I really have to master these functions myself. Quote Link to comment Share on other sites More sharing options...
acctman Posted May 17, 2009 Author Share Posted May 17, 2009 another methods I could try? my only option here is to possibly use an iframe (which i'm trying to avoid) and not an include... since the fill is a template and can except both HTML and PHP coding 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.