Articles: 843 | Categories: 148   
   
   
Home Articles Contact Us
 
 
 
 
PHP Report (0 Comments)
Admin: Posted Date: April 4, 2010

PHP Report is a class to aid in the processing of data before showing it to the end user. Generates nicely formatted and organized reports for ecommerce shops and so on. Configure layout through an HTML template.

PHP Report class

What I can do with it?

Every time you need to process data before show it to the end user you have to do some work on it. Usually that means field formating (date, floats), math operations, page formating, etc. That is what this classes can do for you in a organized way.

Think of a shop cart or a report being generated from SQL data. You have to list products, add columns, multiply one column with another, etc. You may also have to organize the result within groups (headers, subtitles), having a header for each group. You may also need to show some totals from numeric columns or format fields from dates and floats coming from the database so they dont show up as ugly 8 or 12 decimal digits and strange date patterns to the user.

                              

Sure, uou can deal with those problems directly each time you need, going each field one by one, or you could use the Report class. Just feed in your data, a HTML template and some definitions and you'll get a very nice html page to show to the user.

Currently you can parse the data and:

  • have sums of columns,
  • apply math operations on columns generating new columns and
  • apply math operations and functions (yours or system ones) on columns generating new columns and
  • apply functions (yours or system ones) directly to columns altering their values.
  • The Report class in the package use several HTML templates classes to parse the result. To understand what a template is and how it works please reffer to the documentation of each supported class. Working suported template classes are PEAR::HTML_Template_IT and PEAR::HTML_Template_PHPLIB, from PEAR or phplib directly, this last template is kept for compatibility with some old work. PEAR::HTML_Template_Sigma is in the package but isnt working yet, i will fix that soon. The classes you will use besides having PEAR installed in you server are:

  • Report.php THE class.
  • Report template.php 'Interface' to the 'raw' PHPLib template not the PEAR one.
  • Report PHPLIB.php 'Interface' to the PEAR::HTML_Template_PHPLIB.
  • Report IT.php 'Interface' to PEAR::HTML_Template_IT ( fixed!).
  • Report Sigma.php 'Interface' to the PEAR::HTML_Template_Sigma ( but... not working, block parsing is broken).
  • To choose the template classe you want to use, edit the Report.php and include, or require once, the one you want.
    That in the future should change to use a factory pattern.

     

     
     
    Add a Comment:
     
    (You must be signed in to comment on an article. Not a member? Click here to register)
       
    Title:

    Comments: