RE: Output text status on a long class

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

 



> On Tue, Oct 14, 2008 at 11:30 AM, Chrome <admin@xxxxxxxxxxxx> wrote:
> >> 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
> >
> 
> Did you also read the notes in the description for flush()?
> 
> http://www.php.net/manual/en/function.flush.php

I'm reading through them now :)

For the record I have included a 256 char long whitespace string along with any prospective output but still no joy

Opera 9.60 reliably informs me it's received 258 bytes but displays nothing

I'll carry on with this for a little before blaming the browsers (testing also in FF3) and putting in a 'This is going to take bloody ages' note :)

Thanks for all the input

Dan

> Andrew
> 
> --
> 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