![]() HTML_Progress2 : The Definitive Guide
|
Without any change, we can get a decent progress generator tabbed wizard such as :
Color, font, size and position are defined by default in stylesheet default.css you can find into PEAR HTML_Progress2 data directory.
As you can see in source code below, there are no difficulty.
<?php require_once 'HTML/Progress2/Generator.php'; session_start();$tabbed = new HTML_Progress2_Generator();
$tabbed->run();
?>
![]() |
HTML_Progress2_Generator does not start a session automatically, you should explicitly call session_start before instantiating the controller class. A session is required to pass data between the tabbed multi-pages generator wizard. |
|||
![]() |
Without any arguments, all defaults are applied on HTML_Progress2_Generator new instance construction.
|
|||
![]() |
Catch all user actions (next, back, jump, apply, process) and display controller wizard contents. |
Now we have seen basic usage, we will try to change the skin with only a new stylesheet.
<?php require_once 'HTML/Progress2/Generator.php'; session_start(); $tabbed =& HTML_Progress2_Generator::singleton(); $tabbed->addActions(array('dump' => 'ActionDump'));$css = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'generator.css';
$tabbed->addAction('display', new ActionDisplay($css));
$tabbed->run(); ?>
![]() |
This line allow to add/activate the interactive debugging tools that can give you informations on: progress meter, wizard controller forms data, list of included files (see get_included_files), list of declared classes (see get_declared_classes), and list of generator actions defined. |
|||
![]() |
$css defines the location of the new stylesheet to apply. This file will give a grey-orange look and feel such as : ![]()
|
|||
![]() |
This line overload the default display action set during the class instantiation.
We have also possibility to get and set stylesheet with methods
<?php require_once 'HTML/Progress2/Generator.php'; require_once 'HTML/Progress2/Generator/Default.php'; session_start(); $css = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'generator.css'; $display = new ActionDisplay(); $display->setStyleSheet($css); // var_dump($display->getStyleSheet(true)); // var_dump($display->getStyleSheet()); $tabbed =& HTML_Progress2_Generator::singleton(); $tabbed->addAction('display', $display); $tabbed->run(); ?> |
HTML_Progress2 : The Definitive Guide | v 2.1.0 : August 12, 2006 |