CodeIgniter Forums
Output Buffering - ob_flush & flush - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived General Discussion (
+--- Thread: Output Buffering - ob_flush & flush (/thread-21208.html)

Output Buffering - ob_flush & flush - El Forum - 08-03-2009

Hello all,

I have a project that I'm working on that requires me to spit out some information after a long blocking task gets finished. While the task is running I need to display a page to the user to let them know that it's processing. I've been able to accomplish this functionality outside of CI by using output buffering and ob_flush / flush commands.

This same setup doesn't seem to function inside of a CI view, presumably because of the magic going on in displaying the view. I've tried doing some Googling but I didn't come across any clear solutions. Could someone give me a push in the right direction as to what I should be looking at to accomplish this?


Output Buffering - ob_flush & flush - El Forum - 08-03-2009

After digging around in CI's internals a bit I managed to figure this out. It's one of those so simple I didn't think of it kind of things. The solution I found was just to skip calling ob_start in your view since CI will call it for you. Then in your view you should be able to flush as needed.

Output Buffering - ob_flush & flush - El Forum - 08-03-2009

Ahh. I read your earlier message, and it reminded me to go hunting for my notes as I'd discovered some ob_flush weirdness when I was experimenting with another library recently - and I think it was the FireBug/FirePHP plugin that was giving me some very odd behaviour. As I say, I can't recall the nature, or what I did to resolve it, but I do recall it involved reading up on the output buffering functions .. and ending up just as confused at the end of it.

Glad you got it resolved, in any case.