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? 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. 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 ... 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 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. 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. 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. Link to comment https://forums.phpfreaks.com/topic/173062-var-include-pagephp/#findComment-912183 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.