GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
HTML::TableTiler(3) User Contributed Perl Documentation HTML::TableTiler(3)

HTML::TableTiler - easily generates complex graphic styled HTML tables

The latest versions changes are reported in the Changes file in this distribution.

Prerequisites
    HTML::PullParser >= 1.0
    IO::Util         >= 1.2
    
CPAN
    perl -MCPAN -e 'install HTML::TableTiler'
    
Standard installation
From the directory where this file is located, type:

    perl Makefile.PL
    make
    make test
    make install
    

the tile
    <table border="1" cellspacing="2" cellpadding="2">
    <tr>
        <td><b><i>a optional placeholder</i></b></td>
        <td>another optional placeholder</td>
    </tr>
    </table>
    
the code
    $matrix=[
               [ 'Balls', 'A470', 250, 2.75 ],
               [ 'Cubes', 'A520', 378, 3.25 ],
               [ 'Cones', 'A665', 186, 2.85 ]
            ];
    

Object-Oriented interface:

    use HTML::TableTiler;
    $tt = HTML::TableTiler->new(\$tile);
    print $tt->tile_table($matrix);
    

Function-Oriented interface

    use HTML::TableTiler qw(tile_table);
    print tile_table($matrix, \$tile);
    
the tiled table
    <table border="1" cellspacing="2" cellpadding="2">
    <tr>
        <td><b><i>Balls</i></b></td>
        <td>A470</td>
        <td>250</td>
        <td>2.75</td>
    </tr>
    <tr>
        <td><b><i>Cubes</i></b></td>
        <td>A520</td>
        <td>378</td>
        <td>3.25</td>
    </tr>
    <tr>
        <td><b><i>Cones</i></b></td>
        <td>A665</td>
        <td>186</td>
        <td>2.85</td>
    </tr>
    </table>
    

HTML::TableTiler uses a minimum HTML table as a tile to generate a complete HTML table from a bidimensional array of data. It can easily produce simple or complex graphic styled tables with minimum effort and maximum speed.

Think about the table tile as a sort of tile that automatically expands itself to contain the whole data. You can control the final look of a table by choosing either the HORIZONTAL and the VERTICAL tiling mode among: PULL, TILE and TRIM.

The main advantages to use it are:

  • automatic table generation

    Pass only a bidimensional array of data to generate a complete HTML table. No worry to decide in advance the quantity of cells (or rows) in the table.

  • complex graphic patterns generation without coding

    Just prepare a simple table tile in your preferred WYSIWYG HTML editor and let the module do the job for you.

  • simple to maintain

    You can indipendently change the table tile or the code, and everything will go as you would expect.

Below this paragraph you should see several HTML examples. If you don't see any example, please take a look at the Examples.html file included in this distribution: an image is worth thousands of words (expecially with HTML)!

new ( [tile] )
The constructor method generate a HTML::TableTiler object. It accepts one optional tile parameter that can be a reference to a SCALAR content, a path to a file or a filehandle. If you don't pass any tile to the constructor method, a plain tile will be used internally to generate a plain HTML table. A tile must be a valid HTML chunk containing at least one "<tr> ... </tr>" area. See "HTML Examples" or the Examples.html file in order to know more useful details about table tiles.

Examples of constructors:

    $tt = HTML::TableTiler->new( \$tile_scalar );
    $tt = HTML::TableTiler->new( '/path/to/table_tile_file' );
    $tt = HTML::TableTiler->new( *TABLE_TILE_FILEHANDLER );
    $tt = HTML::TableTiler->new(); # default \'<table><tr><td></td></tr></table>'
    
is_matrix( array_reference )
This method checks if the passed array_reference is a matrix (i.e. an array of arrays). It returns 1 on success and 0 on failure. It is called automatically by the "tile_table()" method unless you pass a true value as tird argument.
tile_table ( matrix [, mode ] [, checked] )
This method generates a tiled table including the data contained in matrix. The matrix parameter must be a reference to a bidimensional array:

    $matrix=[
               [ 'Balls', 'A470', '250', '2.75' ],
               [ 'Cubes', 'A520', '378', '3.25' ],
               [ 'Cones', 'A665', '186', '2.85' ]
            ];
    

The mode parameter must be scalar containing one or two literal words representing ROW and COLUMN tiling mode. These are the accepted modes:

H_PULL
The grafic style of each rightmost CELL in the tile will be rightward replicated. This is the default HORIZONTAL tiling mode, so if you don't explicitly assign any other H_* mode, this mode will be used by default.
H_TILE
The grafic style of each ROW in the tile will be rightward replicated.
H_TRIM
The table ROW will be trimmed to the tile ROW, and the surplus data in matrix will be ignored.
V_PULL
The grafic style of each bottommost CELL in the tile will be downward replicated. This is the default VERTICAL tiling mode, so if you don't explicitly assign any other V_* mode, this mode will be used by default.
V_TILE
The grafic style of each COLUMN in the tile will be downward replicated.
V_TRIM
The table COLUMN will be trimmed to the tile COLUMN, and the surplus data in matrix will be ignored.

Examples:

    $tt->TableTiler( \@matrix, "V_TRIM H_TILE" );
    $tt->TableTiler( \@matrix, "V_TILE" ); # default "H_PULL"
    $tt->TableTiler( \@matrix );             # default "H_PULL V_PULL"

Different combinations of tiling modes and tiles can easily produce complex tiled tables. (See "HTML Examples" or the Examples.html file for details.)

A true checked argument avoid the "is_matrix" method to be internally called.

tile_table ( matrix [, tile [, mode ]] )
If you prefer a function-oriented programming style, you can import or directly use the "tile_table()" function:

    use HTML::TableTiler qw( tile_table );
    print tile_table( \@matrix, \$tile, "V_TILE" );
    print tile_table( \@matrix );

    # or
    use HTML::TableTiler;
    print HTML::TableTiler::tile_table( \@matrix, \$tile, "V_TILE" );
    print HTML::TableTiler::tile_table( \@matrix);
    

Note that you have to pass the tile as the optional second parameter, and the mode as the optional third parameter. (See method "tile_table()" for details).

Template::Magic::HTML, that supplies an extended and transparent interface to this module.

If you need support or if you want just to send me some feedback or request, please use this link: http://perl.4pro.net/?HTML::TableTiler.

© 2002-2004 by Domizio Demichelis.

All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as perl itself.

Hey! The above document had some coding errors, which are explained below:
Around line 833:
Non-ASCII character seen before =encoding in '©'. Assuming CP1252
2005-06-30 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.