|  | HTML |  |
|  | Splash! |  |
|  | PostScript |  |
| Template Toolkit Examples: HTML Library: Tables, Rows and Cells |

|  | index |  |
|  | rgb |  |
|  | headers |  |
|  | lists |  |
|  | links |  |
|  | tables |  |
|  | bars |  |
|  | menus |  |
# Tables, Rows and Cells These elements are for creating HTML tables and the rows and cells within them. In most cases, they offer little benefit over using the regular HTML tags and are more likely to make your templates more complicated and harder to read. But on the other hand, they are useful for various other elements which glue them together in interesting ways to make more complex components (e.g. bars and menus). Think of them as HTML Lego® bricks.
Source #1:
    [% WRAPPER html/table %]
    <tr>
      [%- FOREACH item = [ 'Foo', 'Bar', 'Baz' ] %]
      <td>
        [% item %]
      </td>
      [%- END %]
    </tr>
    [% END %]
| HTML Output #1:
    <table border="0">
    <tr>
      <td>
        Foo
      </td>
      <td>
        Bar
      </td>
      <td>
        Baz
      </td>
    </tr>
    </table>
Output #1:
Foo | Bar | Baz
Source #2:
    [% WRAPPER html/table
         border = 2
         col    = '#aaaaff'
    %]
    <tr>
      <td>
        This is some content within the table.
      </td>
    </tr>
    [% END %]
HTML Output #2:
    <table border="2" bgcolor="#aaaaff">
    <tr>
      <td>
        This is some content within the table.
      </td>
    </tr>
    </table>
Output #2:
This is some content within the table.
Source #3:
    [% PROCESS html/rgb %]

    [% WRAPPER html/table col=rgb.blue.light pad=10 %]
       [%- WRAPPER html/row %]
       <td>Hello</td> <td>World</td>
       [%- END %]
    [% END %]
HTML Output #3:
    <table border="0" cellpadding="10">
    <tr>
       <td>Hello</td> <td>World</td></tr>
    </table>
Output #3:
Hello | World
Source #4:
    [% MACRO light(content)
         INCLUDE html/cell
    	col=rgb.blue.light
    %]

    [% MACRO dark(content)
         WRAPPER html/cell
    	col=rgb.blue.dark
    %]
    <font color="[% rgb.white %]">[% content %]</font>
    [% END %]

    [% WRAPPER html/table pad=10 %]
       [%- WRAPPER html/row %]
           [%- light('Hello') ; dark('World') %]
       [%- END %]
       [%- WRAPPER html/row %]
           [%- dark('Hello') ; light('World') %]
       [%- END %]
    [% END %]
Output #4:
Hello | World
Hello | World
Source #5:
    [% WRAPPER html/table + html/row + html/cell
         col = rgb.red.mid
         pad = 6
    %]
    <font color="[% rgb.white %]">Hello World!</font>
    [% END %]
Output #5:
Hello World!