PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Default render

Without any change, we can get a decent dialog box with a default progress meter such as :

As you can see in source code below, there are no difficulties.

<?php
require_once 'HTML/Progress2/Monitor.php';

$pm = new HTML_Progress2_Monitor(); 1

$pb =& $pm->getProgressElement(); 2
$pb->setAnimSpeed(200);
$pb->setIncrement(10);
?>
<html>
<head>
<?php
echo $pm->getStyle(false);  3
echo $pm->getScript(false); 3
?>
</head>

<body>
<?php
$pm->display();  4
$pm->run();      5
?>
</body>
</html>
   

1

Without any arguments, all defaults are applied on HTML_Progress2_Monitor new instance construction.

$formName (argument 1 of class constructor)

Name of monitor dialog box (QuickForm). Default is ProgressMonitor

$attributes (argument 2 of class constructor)

List of renderer options. Default are

  • dialog box title = In progress ...
  • dialog box start button = Start
  • dialog box cancel button = Cancel
  • dialog box button style = no style
  • autorun feature = false
  • dialog box caption = bottom left aligned under progress meter

2

For demonstration purpose only, we get embedded basic progress meter into the progress monitor and change increment and speed(delay) to do a smooth animation.

3

We get cascading stylesheet and javascript code mandatory to a good progress meter presentation and handling.

4

Show initial state of progress monitor before running. Will works only with default QF renderer.

5

Catch user actions (start, stop) and meter progression.

This monitor do nothing yet. In next example we will see how to improve a bit the presentation.

HTML_Progress2 : The Definitive Guide v 1.0.0 : September 23, 2005