August 27, 2003
By Laurent Laville
No details are really necessary here to understand what will happens. See output after PHP script.
Take care that when you give a javascript URL and the linked file does not exists, then HTML_Progress assume that internal code (getScript method) will be used. See below :
$bar = new HTML_Progress_Bar_Horizontal('reverse', null, $options, 'progress.js');progress4r.php
<?php /** * Display a horizontal loading bar from 0 to 100% increase by step of 10% * in reverse order with custom configuration. * Try to override Javascript internal code. * If external file does not exists then internal code is used. * * @version $Id: howto-part4.html,v 1.2 2003/08/27 22:52:37 Farell Exp $ * @author Laurent Laville <pear@laurent-laville.org> * @package HTML_Progress */ require_once ('HTML/Progress/BarHorizontal.php'); $options = array( 'border-width' => 1, 'cell-width' => 20, 'active-color' => '#970038', 'inactive-color'=> '#FFDDAA' ); $bar = new HTML_Progress_Bar_Horizontal('reverse', null, $options, 'progress.js'); $text = array( 'size' => 14, 'color' => 'red', 'v-align' => 'top', 'h-align' => 'left' ); $bar->setText(true, $text); for ($i=0; $i<10; $i++) { if ($bar->getProgress() == 50) { echo '<h1>Example 4 reverse</h1>'; } if ($bar->getProgress() == 60) { echo '<p><i><b>Laurent Laville, August 2003</b></i></p>'; } if ($bar->getProgress() == 70) { echo '<br /><hr noshade />'; } $bar->display(10); } ?>This example will produce :
and when progress bar reach 50%,
Example 4 reverseand when progress bar reach 60%,
Laurent Laville, August 2003and when progress bar reach 70%,
[Top]