PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Data Management related

moveNext(), moveStep()

Changes value of the progress meter to the next value or next step.

These new methods were introduced with the new multiple label system, and should replaced incValue() deprecated.

[Note] Note
incValue() method is almost equivalent to moveStep() except that it did not provide display refresh.

Here is sample of your script version with HTML_Progress 1.x :

  1. <?php
  2. require_once 'HTML/Progress.php';
  3.  
  4. $pb = new HTML_Progress();
  5. $pb->setAnimSpeed(100);
  6. ?>
  7. <html>
  8. <head>
  9. <style type="text/css">
  10. <!--
  11. <?php echo $pb->getStyle(); ?>
  12.  -->
  13. </style>
  14. <script type="text/javascript">
  15. <!--
  16. <?php echo $pb->getScript(); ?>
  17. //-->
  18. </script>
  19. </head>
  20. <body>
  21. <?php
  22. echo $pb->toHtml();
  23.  
  24. do {
  25.     $pb->display();    // <--- to remove !!!
  26.     if ($pb->getPercentComplete() == 1) {
  27.         break;
  28.     }
  29.     $pb->sleep();
  30.     // your long process goes here !
  31.     $pb->incValue();   // <--- to replace !!!
  32. } while(1);
  33. ?>
  34. </body>
  35. </html>

And your script version with HTML_Progress2 :

  1. <?php
  2. require_once 'HTML/Progress2.php';
  3.  
  4. $pb = new HTML_Progress2();
  5. $pb->setAnimSpeed(100);
  6. ?>
  7. <html>
  8. <head>
  9. <?php
  10. echo $pb->getStyle(false);
  11. echo $pb->getScript(false);
  12. ?>
  13. </head>
  14. <body>
  15. <?php
  16. $pb->display();
  17.  
  18. do {
  19.     if ($pb->getPercentComplete() == 1) {
  20.         break;
  21.     }
  22.     $pb->sleep();
  23.     // your long process goes here !
  24.     $pb->moveNext();
  25. } while(1);
  26. ?>
  27. </body>
  28. </html>
[Tip] Tip
Of course, if you used the run() method instead of the loop, you have nothing to change.
HTML_Progress2 : The Definitive Guide v 2.4.0 : April 20, 2007