PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Chapter 3. FAQ - Frequently Asked Questions

3.1. General questions
3.1.1. What does it cost ?
3.1.2. Do you offer support ?
3.1.3. I found a bug, what shall i do ?
3.1.4. What is HTML_Progress2_Lite ?
3.1.5. What is PHP_Compat ?
3.1.6. What is HTML_QuickForm ?
3.1.7. What is HTML_QuickForm_Controller ?
3.1.8. What is PEAR ?
3.1.9. What is PEAR_ErrorStack ?
3.1.10. What is Event_Dispatcher ?
3.2. Troubleshooting guide
3.2.1. I saw nothing on my browser screen
3.2.2. The progress meter is running, but I see no changes
3.2.3. The progress meter seems to be frozen at 100%, I see no changes
3.3. How to
3.3.1. How to include a progress meter in my upload form ?
3.3.2. How to implement an AJAX Progress Bar ?

3.1. General questions

3.1.1. What does it cost ?
3.1.2. Do you offer support ?
3.1.3. I found a bug, what shall i do ?
3.1.4. What is HTML_Progress2_Lite ?
3.1.5. What is PHP_Compat ?
3.1.6. What is HTML_QuickForm ?
3.1.7. What is HTML_QuickForm_Controller ?
3.1.8. What is PEAR ?
3.1.9. What is PEAR_ErrorStack ?
3.1.10. What is Event_Dispatcher ?
3.1.1.

What does it cost ?

You can download and use it for free. But don't delete the copyright notice. You can read terms of the license

3.1.2.

Do you offer support ?

YES if there is no answer in this Guide and if you are ready to share some informations such as : your configuration (platform Win *nix mac, PHP version, PEAR packages installed) and perharps your script.

3.1.3.

I found a bug, what shall i do ?

You can report it with the bug tracker at PEAR.

3.1.4.

What is HTML_Progress2_Lite ?

HTML_Progress2_Lite is less customizable than its father HTML_Progress2, but allows to do almost the same things. This class has no dependency and can be used completely outside the PEAR infrastructure.

3.1.5.

What is PHP_Compat ?

PHP_Compat provides missing functionality for older versions of PHP. This class has no dependency and can be used completely outside the PEAR infrastructure.

3.1.6.

What is HTML_QuickForm ?

HTML_QuickForm is a PEAR package that provides methods for creating, validating and processing HTML forms.

The purpose of Keith Edmunds tutorial is to give the new users of QuickForm an overview of its features and usage patterns. It describes a small subset of available functionality.

Don't forget to read also the PEAR Manual, HTML_QuickForm related part.

3.1.7.

What is HTML_QuickForm_Controller ?

HTML_QuickForm_Controller is a PEAR package that implements a PageController design pattern, which essentially means that there is a single page processing requests and actions this page performs.

This package is used only with the HTML_Progress2_Generator (an interactive tools to create your own progress meter).

Don't forget to read also the PEAR Manual, HTML_QuickForm_Controller related part.

3.1.8.

What is PEAR ?

PEAR (an acronym for PHP Extension and Application Repository) is a framework and distribution system for reusable PHP components.

Don't forget to read also the PEAR Manual and PEAR FAQ.

3.1.9.

What is PEAR_ErrorStack ?

PEAR_ErrorStack implements error raising and handling using a stack pattern. This has tremendous advantages over the PEAR_Error Implementation.

Don't forget to read also the PEAR Manual, PEAR_ErrorStack related part.

3.1.10.

What is Event_Dispatcher ?

Event_Dispatcher is a PEAR package that acts as a notification dispatch table. It is used to notify other objects of interesting things.

Event_Dispatcher is used to allow observers to hook into the progress meter process. Whenever a progress bar value changes, a notification onChange is sent. Others notification events are available: onSubmit, onLoad, and onCancel (for monitor only).

Don't forget to read also the PEAR Manual, Event_Dispatcher related part.

3.2. Troubleshooting guide

3.2.1. I saw nothing on my browser screen
3.2.2. The progress meter is running, but I see no changes
3.2.3. The progress meter seems to be frozen at 100%, I see no changes
3.2.1.

I saw nothing on my browser screen

You've forgot to put the necessary styles (CSS) on your HTML document. Add the getStyle() method.

Either with the style tags :

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

Or without the style tags :

  1. <?php
  2. require_once 'HTML/Progress2.php';
  3.  
  4. $pb = new HTML_Progress2();
  5.  
  6. echo $pb->getStyle(false);
  7. $pb->display();
  8. ?>
3.2.2.

The progress meter is running, but I see no changes

The waiting bar of your favorite browser is running, but you don't see anything on the screen. You've forgot to put the necessary javascript code that manage the progress meter. Add the getStcript() method.

Either with the script tags :

  1. <?php
  2. require_once 'HTML/Progress2.php';
  3.  
  4. $pb = new HTML_Progress2();
  5. $pb->setAnimSpeed(100);
  6. ?>
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  8.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  10. <head>
  11. <title>Progress2 Basic example</title>
  12. <style type="text/css">
  13. <!--
  14. <?php echo $pb->getStyle(); ?>
  15.  -->
  16. </style>
  17. <script type="text/javascript">
  18. <!--
  19. <?php echo $pb->getScript(); ?>
  20. //-->
  21. </script>
  22. </head>
  23. <body>
  24. <?php
  25. $pb->display();
  26. $pb->run();
  27. ?>
  28. </body>
  29. </html>

Or without the script tags :

  1. <?php
  2. require_once 'HTML/Progress2.php';
  3.  
  4. $pb = new HTML_Progress2();
  5. $pb->setAnimSpeed(100);
  6. ?>
  7. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  8.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  10. <head>
  11. <title>Progress2 Basic example</title>
  12. <?php
  13. echo $pb->getStyle(false);
  14. echo $pb->getScript(false);
  15. ?>
  16. </head>
  17. <body>
  18. <?php
  19. $pb->display();
  20. $pb->run();
  21. ?>
  22. </body>
  23. </html>
3.2.3.

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

Using run() method 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 behavior). Use the setAnimSpeed() method to set the delay from 1 to 1000 milliseconds. In example below delay is only 0.5 second.

  1. <?php
  2. require_once 'HTML/Progress2.php';
  3.  
  4. $pb = new HTML_Progress2();
  5. $pb->setAnimSpeed(500);
  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. $pb->run();
  18. ?>
  19. </body>
  20. </html>

Another possible reason is due to your firewall or anti-virus software. Check-out if the web content protection is active or not. If is set to true, try to de-activate it and see if you have still the problem.

[Note] Note
Thanks to Mathieu GRELIER for his feedback on anti-virus software problem : Progress2 (and PHP flush function) is not compatible with real-time web parsing softwares.
[Tip] Tip
With Kaspersky Anti-Virus 6, look in configuration panel, network port control, and de-activate the http-standard port 80.

3.3. How to

3.3.1. How to include a progress meter in my upload form ?
3.3.2. How to implement an AJAX Progress Bar ?
3.3.1.

How to include a progress meter in my upload form ?

Before AJAX it was impossible to do with a pure PHP solution. By the way, there are some mixed solutions that exists on the Web. Here is a short list :

http://jupload.biz/

JUpload is an easy to use java applet for uploading multiple files to the webserver using the post method of html forms as described in RFC 1867.

http://www.aspupload.com/

AspUpload is a COM+ component which enables an ASP application to capture, save and process files uploaded to the web server with a browser.

http://www.raditha.com/php/progress.php

Mega Upload is a file uploader with a progress monitor. There are three separate editions for the three most popular web programming languages PHP/Perl/JSP.

http://pdoru.from.ro/

Upload Progress Meter is a patch for PHP4 or PHP5.

Now with AJAX, and some PHP extension (like APC with PHP 5.2+, or PECL uploadprogress) that used the RFC1867 hook to track progress of file upload, dream begin a reality !

See chapter How to to implement an AJAX Upload with Progress Bar solution to learn more.

3.3.2.

How to implement an AJAX Progress Bar ?

Since release 2.3.0, there was an existing text file included into distribution named HOWTO_AJAX.txt. Content of this file is now integrated into this guide. Read chapter How to to implement an AJAX Progress Bar to learn more.

HTML_Progress2 : The Definitive Guide v 2.4.0 : April 20, 2007