Re: help in implementing a progress bar

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

 



On Jan 7, 2010, at 2:36 PM, Vinay Kannan wrote:

> Hello,
> 
> Theres this project that I am working on, and a specific module does take
> few secs to process, I am thinking it would be cool to be showing a progress
> bar(some kind on a .gif image) while the script runs, does any one have an
> idea how to implement this?
> 
> Thanks,
> Vinay K

This isn't really database related, but ok...

<?php
// Progress.php
class Progress {
    public function start () {
        echo file_get_contents ('progress.html');
        flush ();
    }
    public function end ($url) {
        $text  = "<script type=\"text/javascript\">";
        $text .= "window.location = '$url';";
        $text .= "</script>";
        
        echo $text;
        flush ();
    }
}
?>

<?php
// process.php - process the stuff
$progress = new Progress();
$progress->start();
// ... Do your processing here ...
$progress->end('nextpage.php');
?>

In the progress.html file, it would just be an html page that has an animated gif (and whatever else you want on it). Hope this helps.

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



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux