HTML_Progress
[ class tree: HTML_Progress ] [ index: HTML_Progress ] [ all elements ]
Prev Next
HTML_Progress_UI::setStringAttributes
sets the look and feel of the progress meter string

Synopsis

require_once 'HTML/Progress/UI.php';

void HTML_Progress_UI::setStringAttributes( mixed $attributes)

Description

This method is used to give a look and feel, such as alignment, size and color, to the progress meter string.

$attributes is an associative array or string of HTML tag attributes.

Parameter

    mixed $attributes
  • the new string attributes of the progress meter.

    Key-values allowed are:

    Attribute Format Default value
    id string installationProgress
    width integer 50
    font-family string Verdana, Arial, Helvetica, sans-serif
    font-size integer 12
    color string #000000
    background-color string #FFFFFF
    align string right
    valign string HB=right, VB=bottom (HB:Horizontal Bar, VB:Vertical Bar)

Note

( HTML_Progress >= 1.0 )

This function can not be called statically.

You may also used an existing StyleSheet and a CSS class-selector with pre-defined style. For example:

  1. <?php
  2. require_once 'HTML/Progress.php';
  3.  
  4. $bar = new HTML_Progress();
  5. // specify a user-ident (instead of the auto-generated value)
  6. $bar->setIdent('myPB');
  7. $bar->setStringPainted(true);
  8.  
  9. $ui =& $bar->getUI();
  10. $ui->setStringAttributes('id="myPBstring"');
  11. ?>
could be replaced by:

<style type="text/css">
<!--
.myPB .myPBstring { width: 100px; background-color: lightyellow; color: black; }
// -->
</style>

See

HTML_Progress_UI::getStringAttributes, HTML_Progress::setStringPainted

Example

Example below will produced a progress bar with a custom style string. It's a static example, the progress bar will not run.

  1. <?php
  2. require_once 'HTML/Progress.php';
  3.  
  4. $bar = new HTML_Progress();
  5. $bar->setValue(50);
  6. $bar->setBorderPainted(true);
  7.  
  8. $ui =& $bar->getUI();
  9. $ui->setFillWay('reverse');
  10. $ui->setCellCount(5);
  11. $ui->setCellAttributes('active-color=#970038 inactive-color=#FFDDAA width=20');
  12. $ui->setBorderAttributes('width=1 color=#000000');
  13. $ui->setStringAttributes('font-size=14 color=#FF0000 align=left valign=bottom');
  14. ?>
  15. <!DOCTYPE html
  16. PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  17. "http://www.w3c.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  18.  
  19. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
  20. <head>
  21. <title>setStringAttributes example</title>
  22. <style type="text/css">
  23. <!--
  24. <?php echo $bar->getStyle(); ?>
  25. // -->
  26. </style>
  27. <script type="text/javascript">
  28. <!--
  29. <?php echo $ui->getScript(); ?>
  30. //-->
  31. </script>
  32. </head>
  33. <body>
  34.  
  35. <?php echo $bar->toHtml(); ?>
  36.  
  37. </body>
  38. </html>

Prev Up Next
HTML_Progress_UI::getStringAttributes Reference Guide HTML_Progress_UI::getProgressAttributes

Documentation generated on Sun, 12 Sep 2004 20:23:27 +0200 by phpDocumentor 1.3.0RC3