PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Multiple Labels usage

Figure 19.3. Multi Labels usage

Multi Labels usage

Goals of this example is to show multiple labels usage. All four kind of label are presented with addLabel() and setLabelAttributes() methods implementation.

Example 19.3. Four kind of progress label

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

$pb = new HTML_Progress2();
$pb->setAnimSpeed(300);
$pb->setIncrement(10);

// Adds additional labels
$pb->addLabel(HTML_PROGRESS2_LABEL_TEXT, 'txt1', 'Fire at will');

$pb->addLabel(HTML_PROGRESS2_LABEL_CROSSBAR, 'crs1');
$pb->setLabelAttributes('crs1', array(
    'valign' => 'top',
    'align'  => 'center',
    'width'  => 170,
    'color'  => 'blue'
));

$pb->addLabel(HTML_PROGRESS2_LABEL_STEP, 'stp1');
$pb->setLabelAttributes('stp1', array(
    'valign' => 'bottom',
    'color'  => 'blue'
));

$pb->addLabel(HTML_PROGRESS2_LABEL_BUTTON, 'btn1', 'Run again');
$pb->setLabelAttributes('btn1', array(
    'width' => 100,
    'top' => 0,
    'color' => 'red'
));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Labels Progress2 example</title>
<style type="text/css">
<!--
<?php echo $pb->getStyle(); ?>

body {
    background-color: #E0E0E0;
    color: #000000;
    font-family: Verdana, Arial;
}
 -->
</style>
<?php echo $pb->getScript(false); ?>
</head>
<body>

<?php
$pb->display();
$pb->run();
?>

</body>
</html>
      
     

HTML_Progress2 : The Definitive Guide v 2.1.0 : August 12, 2006