We need two things, besides the class, a data set to work with and a html page to show our data. We will start with a very simple array, without headers and a simple template.
This will be our data:
| Your data |
|
| See that have a date and some numeric fields to play with in our data. We will work with those fields in the next lessons. The negative value will be used there too. |
| The HTML template |
|
| The block named 'values' in the HTML template is the standard block name expected by the class. You can change it if you need, we dont right now. |
To make the report we use the code bellow:
<?php
/**
* php Report lesson 1
*
* (c) 2004 Sebastiao Rocha A. Neto
*/
require_once("../src/Report.php");
// Read the array
require_once("array-1.php");
// Create the report
$report =& new Report($list, ".", "array-1.htm");
// Prepare the data
$report->makeReport();
// Show it
$report->show();
?>
Look that we have spent three lines to generate the result. To see it click here.
Ok, you're not impressed, right? You could do that yourself using just the
template classes, i know. But that is lesson 1, ok? :) Go
to lesson 2, to see some different stuff.