Examples TOCexamples

setModel

$Date: 2005/07/25 10:25:43 $

 Table of contents

Introduction

This example requires :


This example will run a horizontal ProgressBar defined by an external configuration file.

The setModel feature is useful, when you don't want to change your php scripts but only the look and feel of the progress meter.

[Top]

 Render options

Here are options to build this progress bar :
(1) speed  = 250
(2) increment = 5
(3) javascript = "../horizontal/progress_number.js"
(4) fillway = reverse
(5) count = 20
(6) active-color   = #970038
(6) inactive-color = #FFDDAA
(6) width          = 20
(6) height         = 20
(7) width = 1
(7) color = #000000
(8) width     = 440
(8) font-size = 14
(8) color     = #FF0000
(8) align     = center
(8) valign    = bottom
HTML_Progress::setAnimSpeed (1)
HTML_Progress::setIncrement (2)
HTML_Progress_UI::setScript (3)
HTML_Progress_UI::setFillWay (4)
HTML_Progress_UI::setCellCount (5)
HTML_Progress_UI::setCellAttributes (6)
HTML_Progress_UI::setBorderAttributes (7)
HTML_Progress_UI::setStringAttributes (8)

[Top]

 Output

Screenshot

[Top]

 PHP source syntax highlight

  1. <?php
  2. /**
  3.  * Easy set options of a progress meter with PEAR::Config package
  4.  * and a configuration container style 'iniCommented'.
  5.  *
  6.  * @version    $Id: inicommented.php,v 1.2 2005/07/25 10:25:43 farell Exp $
  7.  * @author     Laurent Laville <pear@laurent-laville.org>
  8.  * @package    HTML_Progress
  9.  * @subpackage Examples
  10.  */
  11.  
  12. require 'HTML/Progress.php';
  13.  
  14. $bar = new HTML_Progress();
  15. $bar->setModel('javadanse.ini', 'inicommented');
  16.  
  17. if (HTML_Progress::hasErrors()) {
  18.     $err = HTML_Progress::getError();
  19.     die('<h1>Your configuration file is erroneous</h1>'.$err['message']);
  20. }
  21. ?>
  22. <!DOCTYPE html
  23.     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  24.     "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  25.  
  26. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  27. <head>
  28. <title>Model Progress example</title>
  29. <style type="text/css">
  30. <!--
  31. <?php echo $bar->getStyle(); ?>
  32. // -->
  33. </style>
  34. <script type="text/javascript">
  35. <!--
  36. <?php
  37. $js = $bar->getScript();
  38. if (is_file($js)) {
  39.     echo file_get_contents($js);
  40. } else {
  41.     echo $js;
  42. }
  43. ?>
  44. //-->
  45. </script>
  46. </head>
  47. <body>
  48.  
  49. <?php
  50. echo $bar->toHtml();
  51. $bar->run();
  52. ?>
  53.  
  54. </body>
  55. </html>

[Top]