HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]
Prev Next

setCellCount Manual

defines the number of cell in a progress bar

by by Laurent Laville
mailto:pear@laurent-laville.org
November 2003, Laurent Laville
(HTML_Progress 1.0+)

Synopsis

void setCellCount( $cells )

Attributes

Name Type Default
cells  integer   10  

$cells is an integer with a minimum of 1, but as no maximum limit.

Description

The setCellCount() method is used to set the count of cell in the progress bar.

Example

Example below will produced a progress bar with less than 10 default cells. It's a dynamic example, the progress bar will run.

  1. <?php
  2. require_once ('HTML/Progress.php');
  3.  
  4. $bar = new HTML_Progress();
  5. $bar->setAnimSpeed(100);
  6. $bar->setIncrement(10);
  7. $bar->setBorderPainted(true);
  8.  
  9. $ui =$bar->getUI();
  10. $ui->setFillWay('reverse');
  11. $ui->setCellCount(5);
  12. $ui->setCellAttributes('active-color=#970038 inactive-color=#FFDDAA width=20');
  13. $ui->setBorderAttributes('width=1 color=#000000');
  14. $ui->setStringAttributes('font-size=14 color=#FF0000 align=left valign=bottom');
  15.  
  16. ?>
  17. <!DOCTYPE html
  18.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  19.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  20.  
  21. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  22. <head>
  23. <title>Progress example</title>
  24. <style type="text/css">
  25. <!--
  26. <?php echo $bar->getStyle()?>
  27. // -->
  28. </style>
  29. <script type="text/javascript">
  30. <!--
  31. <?php echo $bar->getScript()?>
  32. //-->
  33. </script>
  34. </head>
  35. <body>
  36.  
  37. <?php 
  38. echo $bar->toHtml()
  39.  
  40. do {
  41.     $bar->display();
  42.     if ($bar->getPercentComplete(== 1{
  43.         break;   // the progress bar has reached 100%
  44.     }
  45.     $bar->incValue();
  46. while(1);
  47. ?>
  48.  
  49. </body>
  50. </html>

See Also

To customize cell size and color, see setCellAttributes Manual

Prev   Next
setBorderAttributes Manual setFillWay Manual

Documentation generated on Mon, 11 Mar 2019 10:15:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.