$Date: 2004/04/18 13:25:43 $
This example will show you how errors could be logged.
An error was volontary made on call of setAnimSpeed() method. By default if you don't specify any logger, a display driver will be added with options below:
To set any logger, it should be defined as an array and given as the last parameter of HTML_Progress class constructor.
Array format :
array( 'display_errors' = 'on' | 'off', 'log_errors' = 'on' | 'off', 'msgCallback' = valid callback for PEAR_ErrorStack, 'contextCallback' = valid callback for PEAR_ErrorStack 'handler' => array( PEAR::Log driverName => array( 'name' => PEAR::Log driver name 'ident' => PEAR::Log driver identification string 'conf' => array( PEAR::Log driver configure options ), 'level' => PEAR::Log driver error level ), ... )
Print out errors (as a part of the output). For production web sites, you're strongly encouraged to turn this feature off, and use error logging instead. Keeping display_errors enabled on a production web site may reveal security information to end users, such as file paths on your Web server, your database schema or other information.
Log errors into a log file (server-specific log, stderr, syslog ...) As stated above, you're strongly advised to use error logging in place of error displaying on production web sites.
So, if you want to turn OFF all output errors, then you may write:
<?php require_once 'HTML/Progress.php'; $logger = array(); $logger['display_errors'] = 'off'; // turn off browser screen output $logger['log_errors'] = 'off'; // turn off all PEAR::Log drivers output $bar = new HTML_Progress($logger); ... ?>
[Top]
Set the PEAR::Log Display driver and its config options
<?php require_once 'HTML/Progress.php'; $logger = array(); $logger['handler']['display'] = array( 'conf' => array( 'printf' => '<b>%s</b>: %s <br/>' . '<font color="blue">' . '[class="%s" method="%s" file="%s" line="%s"]' . '</font>', 'ereg' => 'in (.*)::(.*) \(file (.*) at line (.*)\)' ) ); $bar = new HTML_Progress($logger); ... ?>
[Top]
Critical : invalid input, parameter #1 "$delay" was expecting "integer", instead got "string"
[class="html_progress" method="setanimspeed" file="E:\EasyPHP\php\PEAR\HTML\Progress.php" line="874"]
[Top]
<?php require_once 'HTML/Progress.php'; $logger = array(); $logger['handler']['display'] = array( 'conf' => array( 'printf' => '<b>%s</b>: %s <br/>' . '<font color="blue">' . '[class="%s" method="%s" file="%s" line="%s"]' . '</font>', 'ereg' => 'in (.*)::(.*) \(file (.*) at line (.*)\)' ) ); $bar = new HTML_Progress($logger); $bar->setAnimSpeed('100'); ?> <html> <head> <title>FileLogger Progress example</title> <style type="text/css"> <!-- <?php echo $bar->getStyle(); ?> body { background-color: #EEEEEE; color: #000000; font-family: Verdana, Arial; } // --> </style> <script type="text/javascript"> <!-- <?php echo $bar->getScript(); ?> //--> </script> </head> <body> <?php echo $bar->toHtml(); do { $bar->display(); if ($bar->getPercentComplete() == 1) { break; // the progress bar has reached 100% } $bar->incValue(); } while(1); ?> </body> </html>
[Top]