HTML_Progress_UI::setScript
sets an external JavaScript file to manage the progress meter
Synopsisrequire_once 'HTML/Progress/UI.php';
void HTML_Progress_UI::setScript(
string $url)
DescriptionThis method is used to identify an external JavaScript file, that will used to replace
the default internal code, to manage the progress meter.
$url is an URL that identify a JavaScript file target.
Parameter- string
$url
-
URL to the linked JavaScript file.
ThrowsPossible PEAR_Error values Error level |
Error code |
Error message |
Solution |
exception |
HTML_PROGRESS_ERROR_INVALID_INPUT |
invalid input, parameter #1 "$url" was expecting "string|NULL" |
Fixed the cast of parameter |
error |
HTML_PROGRESS_ERROR_INVALID_INPUT |
invalid input, parameter #1 "$url" was expecting "file exists" |
Give URL of a valid javascript target |
Note( HTML_Progress >= 1.0 )
| This function can not be called statically. |
| If you have provided a custom javascript and want to revert to the built-in-behavior,
set the URL back to NULL. |
SeeHTML_Progress_UI::getScript
ExampleExample below (that requires HTML_Progress >= 1.2.0RC3) will produced a horizontal progress bar
with custom cell contents (see line 23). It's a dynamic example, the progress bar will run.
| |
- <?php
- require_once 'HTML/Progress.php';
-
- $bar = new HTML_Progress();
- $bar->setAnimSpeed(100);
- $bar->setIncrement(10);
- $bar->setBorderPainted(true);
-
- $ui =& $bar->getUI();
- $ui->setCellAttributes(array(
- 'active-color' => '#3874B4',
- 'inactive-color' => '#EEEECC',
- 'width' => 10,
- 'font-size' => 10
- ));
- $ui->setBorderAttributes('width=1 color=navy');
- $ui->setStringAttributes(array(
- 'width' => 60,
- 'font-size' => 14,
- 'background-color' => '#EEEEEE',
- 'align' => 'center'
- ));
- $ui->setScript('progress.js');
-
- foreach (range(0,2) as $index) {
- $ui->setCellAttributes('color=silver', $index);
- }
- foreach (range(3,6) as $index) {
- $ui->setCellAttributes('color=yellow', $index);
- }
- foreach (range(7,9) as $index) {
- $ui->setCellAttributes('color=orange', $index);
- }
- ?>
- <!DOCTYPE html
- PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
- <head>
- <title>setScript 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" src="<?php echo $bar->getScript(); ?>"></script>
- </head>
- <body>
-
- <?php
- echo $bar->toHtml();
- $bar->run();
- ?>
-
- </body>
- </html>
Prev |
Up |
Next |
HTML_Progress_UI::getScript |
Reference Guide |
HTML_Progress_UI::getStyle |
|
|