Reply to Re: PHP 'whilst processing' ideas?

Your name:

Reply:


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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация