RE: Output text status on a long class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Stut wrote:
> > On 14 Oct 2008, at 15:56, Chrome wrote:
> >> I have a class that takes a while to run and am wanting to push some
> >> output
> >> to the browser while it's doing its stuff.  Is that possible?
> >>
> >> Here's what I'd like:
> >>
> >> Connecting to server... Done!
> >> Retrieving categories... Done!
> >> ...
> >>
> >> All I can get it to do is output all of the text at the end of the
> script
> >>
> >> A voice in my head says that outputting all of the text at the end
> of the
> >> script is the only way to do it.  Then another voice says but there
> >> must be
> >> a way! :)
> >>
> >> I did try a quick test of buffering the text then explicitly
> flushing the
> >> buffer but it didn't seem to work
> >>
> >> I know this seems pointless but I'm anticipating that the users will
> be
> >> confused (which would be a surprise </sarcasm>) and attempt to
> >> abort/bugger
> >> off somewhere else
> >
> > Put this line at the top of your script...
> >
> > while (@ob_end_clean());
> >
> > That will remove any output buffers and your script should then
> output
> > stuff as it happens.
> >
> > -Stut
> >
> 
> Or you could add
> 
> flush();
> 
> after your output, which will flush the output buffer and force it to
> display.

I did that as well as stut's suggestion.  And I tried ob_flush() (just in
case).  Tried a few combinations

Personally I think I sometimes have a negative effect on these things

Dan

> Jay
> 
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux