View on
MetaCPAN
Barry King > Apache-Wyrd > Apache::Wyrd::Lattice

Download:
Apache-Wyrd-0.98.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.98   Source  

NAME ^

Apache::Wyrd::Lattice - Generate HTML Tables from Tabular Data

SYNOPSIS ^

  <BASENAME::Lattice>
    <BASENAME::Query>
      <BASENAME::CGISetter style="sql">
        select name, email from contact_database
        where name=$:name
      </BASENAME::CGISetter>
    </BASENAME::Query>
    <BASENAME::Lattice::Header>
      <table class="ctable">
      <tr><th>Name</th><th>E-Mail</th></tr>
    </BASENAME::Lattice::Header>
    <BASENAME::Lattice::Grid>
      <tr bgcolor="#CCCCCC">
        <td class="namecol">$:name</td>
        <td class="emailcol"><a href="mailto:$:email">$:email</a></td>
      </tr></BASENAME::Lattice::Grid>
    <BASENAME::Lattice::Footer></table></BASENAME::Lattice::Footer>
  </BASENAME::Lattice>

DESCRIPTION ^

The Lattice Wyrd represents the result of an Apache::Wyrd::Query Wyrd in HTML. Three supporting Wyrds, Apache::Wyrd::Lattice::Header, Apache::Wyrd::Lattice::Grid, Apache::Wyrd::Lattice::Footer give the HTML a beginning, a repeated middle, and an end.

Unless provided within the Lattice Wyrd, as in the SYNOPSIS, the Lattice Wyrd defaults to a simple HTML table. The cols attribute is parsed (whitespace/comma) to determine these columns. If no cols attribute is given, the Grid Wyrd is scanned for placemarkers in the Apache::Wyrd::Interfaces::Setter style. Lastly, if no Grid Wyrd is given, Lattice will attempt to create a Grid based on the columns returned by the Query. The data will appear in this grid, one column per table column.

HTML ATTRIBUTES

cols

Which columns of the query to display.

PERL METHODS

(format: (returns) name (arguments after self))

(scalar) _format_table (scalar)
(scalar) _format_tr (scalar)
(scalar) _format_th (scalar)
(scalar) _format_td (scalar)

When the Lattice Wyrd is used in default mode, it is very simple to define a default "house style" by implementing the _format_xxx methods for tables, rows, headers, and cells.

BUGS/CAVEATS/RESERVED METHODS ^

Reserves the _setup and _generate_output methods. Also reserves the register_header, register_grid, register_footer, and register_query methods for the respective sub-Wyrds. "Automatic" formatting is provided by the private methods _auto_encapsulate, _auto_header, _auto_grid, _aouto_footer, and _cols_from_grid.

AUTHOR ^

Barry King <wyrd@nospam.wyrdwright.com>

SEE ALSO ^

Apache::Wyrd

General-purpose HTML-embeddable perl object

LICENSE ^

Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.

See LICENSE under the documentation for Apache::Wyrd.

syntax highlighting: