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:
- <?php
- require_once 'HTML/Progress.php';
- $bar = new HTML_Progress();
- ?>
- <style type="text/css">
- <!--
- <?php echo $bar->getStyle(); ?>
- // -->
- </style>
- <?php
- echo $bar->toHtml();
- ?>
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:
- <?php
- require_once 'HTML/Progress.php';
- $bar = new HTML_Progress();
- ?>
- <style type="text/css">
- <!--
- <?php echo $bar->getStyle(); ?>
- // -->
- </style>
- <script type="text/javascript">
- <!--
- <?php echo $bar->getScript(); ?>
- //-->
- </script>
-
- <?php
- echo $bar->toHtml();
-
- do {
- $bar->display();
- if ($bar->getPercentComplete() == 1) {
- break; // the progress bar has reached 100%
- }
- sleep(1); // to replace by your own procedure
- $bar->incValue();
- } while(1);
- ?>
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
- <?php
- require_once 'HTML/Progress.php';
- $bar = new HTML_Progress();
- $bar->setAnimSpeed(500);
- ?>
- <style type="text/css">
- <!--
- <?php echo $bar->getStyle(); ?>
- // -->
- </style>
- <script type="text/javascript">
- <!--
- <?php echo $bar->getScript(); ?>
- //-->
- </script>
-
- <?php
- echo $bar->toHtml();
- $bar->run();
- ?>