Zend_ProgressBar is quite easy in its usage. You
simply create a new instance of Zend_Progressbar, defining a
min- and a max-value, and choose an adapter to output the data. If
you want to process a file, you would do something like:
<?php
$progressBar = new Zend_ProgressBar($adapter, 0, $fileSize);
while (!feof($fp)) {
// Do something
$progressBar->update($currentByteCount);
}
$progressBar->finish();
In the first step, an instance of Zend_ProgressBar is
created, with a specific adapter, a min-value of 0 and a max-value
of the total filesize. Then a file is processed and in every loop
the progressbar is updated with the current byte count. At the end
of the loop, the progressbar status is set to finished.
You can also call the update() method of
Zend_ProgressBar without arguments, which just
recalculates ETA and notifies the adapter. This is useful when there
is no data update but you want the progressbar to be updated.




