|
Posted by Davιmon on 11/18/05 14:22
Etienne Marais wrote:
> Another option is to stream data to the browser using
> php (and javascript). Set the timout directive high enough
> (I think the default is 30 seconds for execution of one
> script). Then, using PHP, monitor the progress and send
> update information after each loop (for instance) to the
> browser:
>
> while ($longtask!="DONE") {
>
> while($process_subtask) {
>
> // time consuming processing (per item)
>
> }
>
> // Fill output buffer to at very least 255 characters
> // Experiment for browser specific needs.
> echo "<!-- ".(str_repeat("*",255))." -->";
> // Report Back
> echo "<br> Task ".($i++)." completed";
> flush();
>
> }
>
> Using this to get started, you can then add Javascript and the DOM
> for HTML to display something nice, like a progress bar or X% completed
> within a table's <td>, i.e. name your <td id='progress> then stream
>
> echo"<script>document.all.progress.firstChild.value='$percentage'</script>";
>
>
>>Look into the ignore_user_abort and set_time_limit functions.
Thank you!
I think the pointer to the flush() function was what I needed, but the
JS is cool too.
--
DavΓ©mon
http://www.nightsoil.co.uk
[Back to original message]
|