Introduction
This example requires :
- PEAR::HTML_Progress 1.2.2 or better (see source at line 15).
- PEAR::HTML_QuickForm 3.1.1 or better.
- PEAR::HTML_Template_IT 1.1 or better.
This example will run a progress meter embedded into a template file.
Template engine is IT(X),
but you could use any others template engine.
On lines 17 thru 32, there is your user-callback (function myFunctionHandler),
where you do what you want. This callback is attached on progress bar at line 80.
Inside this callback, we will show a custom string (build at line 31)
at 25% (lines 22 to 24), at 50% (lines 25 to 27), at 100% (lines 28 to 30).
As for all demos, to smooth animation, i've added a sleep method at line 19.
Delay depends on value set by setAnimSpeed method at line 75. In real world,
you have to do a long task, so delay (sleep) is unnecesary.
Tips: to build custom string, you don't forget to set lines 78 and 79.
Depending of your template engine, you should :
- initialize (at line 34)
- load your template pattern (at line 35)
- merge some template variables with datas (lines 37 thru 42, 98, 99 and 100)
- display final result (at line 105)
Before to run the progress meter at line 107.
Note: usage of quickform is only to show you how to dynamic change look and feel
of progress meter.
[Top]
Render options
Here are options to build the progress bar cells (count=10 filled in natural way):
active-color = #7B7B88
inactive-color = #D0D0D0
width = 10
HTML_Progress_UI::setCellAttributes()
Here are options to build the progress bar string :
width = 320
font-size = 10
align = left
valign = bottom
background-color = #D0D0D0
HTML_Progress_UI::setStringAttributes()
Here are options to build the progress bar itself:
width = 320
HTML_Progress_UI::setProgressAttributes()
[Top]