Table.
A table is a container of tablegroups. Tablegroups are in turn containers of table rows, and table rows contain table cells.
This class is predicated on the idea that tables will be built bit by bit, in a sequential manner by Php code. That is to say, you will be looping through adding to the table structure and content, row by row, and within each row, cell by cell.
Here's an example of usage. Copy and paste into a test page in order to view the result and see how it works.
$mytable = new table("test"); $mytable->autojustify(); $mytable->rowstripes("background-color:#dddddd;,background-color:#efefef;"); $mytable->setalign("center"); $mytable->setwidth("70%"); $mytable->setborder(1); $mytable->thead(); $mytable->tr(); $mytable->th("Heading 1"); $mytable->th("Heading 2", "text-align:right"); $mytable->th("Heading 3"); $mytable->tbody(); $mytable->tr(); $mytable->td("Rowspan Text"); $mytable->td_rowspan(2); $mytable->td("1234"); $mytable->td("Text"); $mytable->tr(); $mytable->td("Text"); $mytable->td("1234"); $mytable->tr(); $mytable->td("Text"); $mytable->td("Text"); $mytable->td("Text"); $mytable->tr(); $mytable->td("Colspan Text"); $mytable->td_colspan(3);
Located in /html-defs.php (line 1982)
RenderableObject | --StylableObject | --HTMLObject | --table
Class | Description |
---|---|
![]() |
A matrix is a table with no colspans or rowspans. It is an N x M |
Auto-justify numerics to the right, text to the left
Padding of cells in pixels
Spacing between cells in pixels
Array containing table groups
Tablename. Required. An internal name for use in debugging etc.
Inherited from HTMLObject
HTMLObject::$accesskey
HTMLObject::$align
HTMLObject::$alt
HTMLObject::$bgcolor
HTMLObject::$bgurl
HTMLObject::$border
HTMLObject::$color
HTMLObject::$height
HTMLObject::$hspace
HTMLObject::$lang
HTMLObject::$langdir
HTMLObject::$linkover_text
HTMLObject::$name
HTMLObject::$onblur
HTMLObject::$onchange
HTMLObject::$onclick
HTMLObject::$ondblclick
HTMLObject::$onfocus
HTMLObject::$onkeydown
HTMLObject::$onkeypress
HTMLObject::$onkeyup
HTMLObject::$onload
HTMLObject::$onmousedown
HTMLObject::$onmousemove
HTMLObject::$onmouseout
HTMLObject::$onmouseover
HTMLObject::$onmouseup
HTMLObject::$onselect
HTMLObject::$size
HTMLObject::$src
HTMLObject::$tabindex
HTMLObject::$target
HTMLObject::$title
HTMLObject::$user_attributes
HTMLObject::$valign
HTMLObject::$vspace
HTMLObject::$width
Inherited from StylableObject
StylableObject::$class
StylableObject::$id
StylableObject::$style
Table constructor Create a new table object.
Append columns onto all rows in the table.
Append a row onto the table.
Set table auto-justify mode on or off.
If set to on, then when we render the table, cells will have a style automatically applied to justify numeric content to the right and non-numeric content to the left. Handy with simple data tables.
Return the number of cells in a specific row.
This is the number of physical cells, rather than the number of logical number of columns. It should be the same as the colcount() method if the table is properly formatted.
Check if given cell exists, return True is it does.
Clear the content from all rows in table. This sets the content of every cell in every row in every group to nullstring.
Return the number of cols in this table.
This is the number of columns, rather than physical cells, any of which may be spanning multiple columns. In the case of a table which is not properly formatted, this function will return the maximum columns it finds by looking across all of the table rows.
Render the table as a CSV formatted stream. This is designed to facilitate the exporting of complex tables of data as CSV format for importing into spreadsheets, or databases etc.
Remove a column from all rows in the table
Remove a row from the table. If the template cell is not provided then a 'vanilla' cell is used.
Return the given cell from this group
Return a given row from the table.
Get the width profile from the table.
Render the whole table as HTML If dedbugging mode is enabled and the DBG_TABLES flag is set, then we run a simple validation check, and report findings, as well as making sure the table borders are visible.
Insert a column into all rows in the table. If the template cell is not provided, then a 'vanilla' cell is used instead.
Insert a row into the table. If the template cell is not provided, then a 'vanilla' cell is used instead. We insert the new row just before the given row.
Apply a colspan in an existing table. The row and column of the
cell which has the colspan is given. As a result the relevant spanned cells will be merged in the table. If the span goes beyond the row end, it is truncated. NB: If the spanning cell is already spanning cells, then the span will extend this by the number given.
Merge rows at a given cell column.
Peek content from the given row,col cell..
Set cell permissions across entire table
Set permission on given table cell. Optionally specify the group which is being targetted (default table body). The specified cell will have its access permission set to the given perm.
Poke some content into the given row,col cell..
Poke a css class/style onto the given row,col cell..
Define css for row striping with comma-delimted list of css. Any number of these can be added to style rows in a repeating cycle.
Set nbsp setting for cells in this table
Set the table padding and spacing amounts. This sets the table 'cellpadding' and 'cellspacing' attributes, in that order.
Replace the given cell with new table cell. Returns true if ok.
Set a width profile across the row of cells. The profile is passed as either a string or an array. If a string, the widths should be separated by commas. The widths can be absolute pixel values or %'s, and applies these widths to the first row of the given group.
An example string might for instance be '20%,15%,65%'.
Remove a colspan from an existing table. The row and column of the cell which has the colspan is given. As a result the relevant spanned cells will be removed from the table.
Split rows at a given cell column.
Define a new tbody table group.
Define a new standard cell for the current row.
Set the working cell alignment properties in one hit. Use this method AFTER you have defined the cell with the td() method.
Set the working cell colspan property. Use this method AFTER you have defined the cell with the td() method.
Append content to the working cell. Use this method AFTER you have defined the cell with the td() method.
Set the working cell content css properties in one hit. Use this method AFTER you have defined the cell with the td() method. This defines the style or classname to use for the cell content. This will be implemented using span tags.
Set the working cell css properties. Use this method AFTER you have defined the cell with the td() method. This defines the style or classname to use for the cell. Note this is for the cell, rather than the content inside the cell.
Set the working cell height property. Use this method AFTER you have defined the cell with the td() method.
Set the working cell width and height properties in one hit. Use this method AFTER you have defined the cell with the td() method.
Set the working cell rowspan property. Use this method AFTER you have defined the cell with the td() method.
Set the working cell width property. Use this method AFTER you have defined the cell with the td() method.
Define a new tfoot table group.
Define a new heading cell for the current row.
Define a new thead table group.
Alias for td_alignment()
Alias for td_content()
Alias for td_metrics()
Define a new row for the current group.
Unset permission on given table cell. Optionally specify the group which is being targetted (default table body). The specified cell will have its access permission unset from the given perms.
Check the table cell balance. Ie. make sure we have the
same number of cells in each row, taking account of rowspan and of course colspan. NB: Complex mixtures of col and row spanning will not be coped with - this is currently a very simplistic algorithm, intended for fairly basic structures.
Return the number of visible cells in a specific column.
This is the number of viewed cells, rather than the number of physical cells. Ie. if there is a rowspan of 2, then only 1 cell will be counted for it, since only one cell appears in the rendered table.
Return the number of visible cells in a specific row.
This is the number of viewed cells, rather than the number of physical columns. Ie. if there is a colspan of 2, then only 1 cell will be counted for it, since only one cell appears in the rendered table.
Render as WML.
Inherited From HTMLObject
HTMLObject::HTMLObject()
HTMLObject::inherit_attributes()
HTMLObject::setaccesskey()
HTMLObject::setalign()
HTMLObject::setalt()
HTMLObject::setbackground()
HTMLObject::setbgcolor()
HTMLObject::setborder()
HTMLObject::setcolor()
HTMLObject::setheight()
HTMLObject::sethspace()
HTMLObject::setlang()
HTMLObject::setlangdir()
HTMLObject::setname()
HTMLObject::setsize()
HTMLObject::setsrc()
HTMLObject::settabindex()
HTMLObject::settarget()
HTMLObject::settitle()
HTMLObject::setvalign()
HTMLObject::setvspace()
HTMLObject::setwidth()
HTMLObject::set_attribute()
HTMLObject::set_linkover_text()
HTMLObject::set_onblur()
HTMLObject::set_onchange()
HTMLObject::set_onclick()
HTMLObject::set_ondblclick()
HTMLObject::set_onfocus()
HTMLObject::set_onkeydown()
HTMLObject::set_onkeypress()
HTMLObject::set_onkeyup()
HTMLObject::set_onload()
HTMLObject::set_onmousedown()
HTMLObject::set_onmousemove()
HTMLObject::set_onmouseout()
HTMLObject::set_onmouseover()
HTMLObject::set_onmouseup()
HTMLObject::set_onselect()
HTMLObject::set_tabindex()
HTMLObject::taghtml()
Inherited From StylableObject
StylableObject::StylableObject()
StylableObject::clearstyle()
StylableObject::setclass()
StylableObject::setcss()
StylableObject::setid()
StylableObject::setstyle()
Inherited From RenderableObject
RenderableObject::RenderableObject()
RenderableObject::html()
RenderableObject::render()
RenderableObject::wml()
RenderableObject::wmlup()
RenderableObject::xml()
Documentation generated by phpDocumentor 1.3.0RC3