HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]
Prev Next
Appendix C. Frequently Asked Questions

Table of Contents

I got only 0% displayed on left corner of my browser screen

You've forgot to put the necessary styles (CSS) on your HTML document. Adds the HTML_Progress::getStyle or HTML_Progress_UI::getStyle method between style-html-tags, and your code look like:

  1. <?php
  2. require_once 'HTML/Progress.php';
  3. $bar = new HTML_Progress();
  4. ?>
  5. <style type="text/css">
  6. <!--
  7. <?php echo $bar->getStyle(); ?>
  8. // -->
  9. </style>
  10. <?php
  11. echo $bar->toHtml();
  12. ?>

You should see a progress bar like that :



The progress bar is running, but i see no changes

You've forgot to put the requires JavaScript code to manage the progress bar. Adds the HTML_Progress::getScript or HTML_Progress_UI::getScript method between script-html-tags, and your code up and running look like:

  1. <?php
  2. require_once 'HTML/Progress.php';
  3. $bar = new HTML_Progress();
  4. ?>
  5. <style type="text/css">
  6. <!--
  7. <?php echo $bar->getStyle(); ?>
  8. // -->
  9. </style>
  10. <script type="text/javascript">
  11. <!--
  12. <?php echo $bar->getScript(); ?>
  13. //-->
  14. </script>
  15.  
  16. <?php
  17. echo $bar->toHtml();
  18.  
  19. do {
  20. $bar->display();
  21. if ($bar->getPercentComplete() == 1) {
  22. break; // the progress bar has reached 100%
  23. }
  24. sleep(1); // to replace by your own procedure
  25. $bar->incValue();
  26. } while(1);
  27. ?>


The progress meter seems to be frozen at 100%, i see no changes

Using HTML_Progress::run rather than coding a loop as in above example, you've forgot to give a delay to progress animation. Because it's not necessary in real world, almost all cases, the delay is fixed at zero (default behaviour). Uses the HTML_Progress::setAnimSpeed method to fix the delay from 1 to 1000 milliseconds. In example below delay is only 0.5 seconds

  1. <?php
  2. require_once 'HTML/Progress.php';
  3. $bar = new HTML_Progress();
  4. $bar->setAnimSpeed(500);
  5. ?>
  6. <style type="text/css">
  7. <!--
  8. <?php echo $bar->getStyle(); ?>
  9. // -->
  10. </style>
  11. <script type="text/javascript">
  12. <!--
  13. <?php echo $bar->getScript(); ?>
  14. //-->
  15. </script>
  16.  
  17. <?php
  18. echo $bar->toHtml();
  19. $bar->run();
  20. ?>


Prev Up Next
Appendix B. Migration to version 1.2 Appendixes Package HTML_Progress Constants

Documentation generated on Sun, 12 Sep 2004 20:23:38 +0200 by phpDocumentor 1.3.0RC3