Using PEAR's HTML_Table Class - Page 3

Changing the Look of Things

Now that we have learned to build tables with the class, let us take a look at how to spice them up a bit. To do this we have a wide selection of tools which allow us to change the way that the table looks on 3 levels:

Table Level

Row or Column Level

Cell Level

1. At the table level we manipulate properties with either the setAllAttibutes or the updateAllAttributes functions. The only difference between these two functions is that updateAllAttributes will add attributes to your table, leaving current attributes in place while setAllAttributes will replace whatever has been previously set. The usage of these two functions is as follows:

The use of these functions is fairly straight forward but there is one important thing to remember. First the $row and $col attributes are the numbers of the row or column that you wish to change. Numbering of rows and columns starts at 0, so in order to make the first row of the table have a background color of blue, you would use the following code segment: