drisate Posted September 4, 2009 Share Posted September 4, 2009 Hey guys i need to put inside a var a hole php file with all the loops ... Ex $var = include ("page.php"); so i can then use $var and do what ever with it How can i do that? Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/ Share on other sites More sharing options...
corbin Posted September 4, 2009 Share Posted September 4, 2009 You could use output buffering.... file1.php: <?php ob_start(); include 'file2.php'; $content = ob_get_flush(); Or you could rewrite the echo'ing to store it to a variable instead. Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912169 Share on other sites More sharing options...
drisate Posted September 4, 2009 Author Share Posted September 4, 2009 Nop the ob thing is not working ... Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912177 Share on other sites More sharing options...
anatak Posted September 4, 2009 Share Posted September 4, 2009 or you could use fopen and fread Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912179 Share on other sites More sharing options...
trq Posted September 4, 2009 Share Posted September 4, 2009 page.php needs to return any output if you want to do things this way. I must say, its a pretty unusual method. Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912181 Share on other sites More sharing options...
drisate Posted September 4, 2009 Author Share Posted September 4, 2009 Yeah well ai m trying to load the result of a page into a WYSIWYG html texterea. The php page builds up all the blocks and stuff for a weekly newsletter template. It's also used for the clients to see a web version of the email. Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912182 Share on other sites More sharing options...
trq Posted September 4, 2009 Share Posted September 4, 2009 Output buffering sounds more like what you want. Quote Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912183 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.