NAME
HTMLTable - Make a HTML table from DBI query output.
SYNOPSIS
use DBIx::HTMLTable;
&DBIx::HTMLTable::HTMLTable ($data, <options>);
&DBIx::HTMLTable::HTMLTableByRef ($dataref, <options>);
DESCRIPTION
The DBIx::HTMLTable function takes the results of a DBI query and format it as an HTML table. The second argument is a hash of options and table attributes. Options and attributes are described below.
&DBI::HTMLTable::HTMLTable ($data,
{rs => "\n",
fs => ',',
caption => "Caption Text"});
The function DBIx::HTMLTable() uses the query output formatted as a multi-line string, with columns delimited by a field separator (a comma by default) and rows delimited by a record separator (newline by default).
DBIx::HTMLTableByRef() uses a reference to an array of array references, as returned by the DBI fetchall_arrayref() function and similar functions. As with HTMLTable, the second argument is a hash of valid options and attributes, which are described briefly below.
$data = $dbh -> selectall_arrayref( "select \* from $db" );
&DBI::HTMLTable::HTMLTableByRef ($data,
{width => 200,
bgcolor => 'black',
caption => "Text",
border => 2,
width => 300});
An example CGI script is provided in eg/tablequery.cgi in the distribution package.
OPTIONS
These options are used to determine how to interpret data and how to construct tables.
- rs
-
HTMLTable() only. Character delimiter for data rows.
- fs
-
HTMLTable() only. Character delimiter for data columns.
-
If the value of this option is a non-empty string, formats the string as the table's caption.
TABLE ATTRIBUTES
The following is a brief list of attributes which the HTML 4.0 <TABLE> tag recognizes. Consult the HTML 4.0 specification from the W3 Consortium (http://www.w3.org/) for detailed information about each attribute.
- align
- width
- cols
- id
- class
- dir
- title
- style
- onclick
- ondbclick
- onmousedown
- onmouseup
- onmouseover
- onmousemove
- onmouseout
- onkeypress
- onkeydown
- onkeyup
- bgcolor
- frame
- rules
- border
- cellspacing
- cellpadding
VERSION
First release, version 0.10 (alpha).
AUTHOR
Robert Kiesling, rkiesling@mainmatter.com