PEAR Progress2 logo

HTML_Progress2 : The Definitive Guide

Chapter 9. Quick Start with HTML_Progress2_Generator

Table of Contents

Basic concept
Default render and css skin
Template integration

The HTML_Progress2_Generator class allow to build your own progress bar and save PHP and/or CSS basic code for later use. Renders are customizable by QF rendering system and external stylesheet.

In two following examples, we will learn how to change the skin easily, and integrate HTML_Progress2_Generator with your favorite template engine.

Basic concept

Design pattern apply the same HTML_QuickForm_Renderer architecture. So it's easy to change presentation of a progress generator. External stylesheets give more options (color, font, ...) to customize look and feel of your own progress generator.

[Note] Note
Usage of external stylesheet is only available since version 2.1.0

There are 8 renderers available since release 3.1.1 of QuickForm. The following template engines are directly suported: Smarty, HTML_Template_Sigma, HTML_Template_IT, and also with packages HTML_Page2, HTML_QuickForm_Renderer_Tableless

Among these 5 renderers (Default, HTMLPage2, ITDynamic, SmartyDynamic, Tableless), we will have a look on all basic concepts with 2 examples in next sections: default render and css skin, template integration.

1. Resume of uses
1.1. You want to use default QF renderer
1.2. You want to use Smarty
1.3. You want to use IT[x] or Sigma
1.4. You want to use the QF Tableless renderer

1. Resume of uses

1.1. You want to use default QF renderer
1.2. You want to use Smarty
1.3. You want to use IT[x] or Sigma
1.4. You want to use the QF Tableless renderer
1.1. You want to use default QF renderer

Use this driver:

Default

ressource is : HTML/Progress2/Generator/Default.php

default stylesheet is : {data_dir}/HTML_Progress2/default.css

[Tip] Tip
No need to include the driver, HTML_Progress2_Generator do it itself.
1.2. You want to use Smarty

Use this driver:

SmartyDynamic

ressource is : HTML/Progress2/Generator/SmartyDynamic.php

default stylesheet is : {data_dir}/HTML_Progress2/smartydynamic.css

template root dir is : . (current dir)

template cache dir is : cache/

template filename is : smarty-dynamic.tpl

1.3. You want to use IT[x] or Sigma

Use this driver:

ITDynamic

ressource is : HTML/Progress2/Generator/ITDynamic.php

default stylesheet is : {data_dir}/HTML_Progress2/itdynamic.css

template root dir is : . (current dir)

template cache dir is : cache/

template filename is : itdynamic.html

1.4. You want to use the QF Tableless renderer
[Note] Note
HTML_QuickForm_Renderer_Tableless is only available since version 2.1.0

Use this driver:

Tableless

ressource is : HTML/Progress2/Generator/Tableless.php

default stylesheet is : {data_dir}/HTML_Progress2/tableless.css

Explains on {data_dir} reference :

[Note] Note

Where is the PEAR HTML_Progress2 data directory ?

On command line, enter pear config-show, and have a look on data_dir definition. HTML_Progress2 is one of its subdirectories.

HTML_Progress2 : The Definitive Guide v 2.4.0 : April 20, 2007