Class Table

Summary

Fully Qualified Name: CodeIgniter\View\Table

Description

HTML Table Generating Class

Lets you create tables manually or from database result objects, or arrays.

Methods

Name Description Defined By
__construct() Set the template from the table config file if it exists Table
addRow() Add a table row Table
clear() Clears the table arrays. Useful if multiple tables are being generated Table
generate() Generate the table Table
makeColumns() Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count. Table
setCaption() Add a table caption Table
setEmpty() Set "empty" cells Table
setFooting() Set the table footing Table
setHeading() Set the table heading Table
setTemplate() Set the template Table

Method Details

__construct()

Set the template from the table config file if it exists

Parameter Name Type Description
$config array (default:

Returns: void

addRow()

Add a table row

Can be passed as an array or discreet params

Returns: \Table

clear()

Clears the table arrays. Useful if multiple tables are being generated

Returns: \Table

generate()

Generate the table

Parameter Name Type Description
$tableData mixed

Returns: string

makeColumns()

Set columns. Takes a one-dimensional array as input and creates a multi-dimensional array with a depth equal to the number of columns. This allows a single array with many elements to be displayed in a table that has a fixed column count.

Parameter Name Type Description
$array array
$columnLimit int

Returns: array

setCaption()

Add a table caption

Parameter Name Type Description
$caption string

Returns: \Table

setEmpty()

Set "empty" cells

Can be passed as an array or discreet params

Parameter Name Type Description
$value mixed

Returns: \Table

setFooting()

Set the table footing

Can be passed as an array or discreet params

Returns: \Table

setHeading()

Set the table heading

Can be passed as an array or discreet params

Returns: \Table

setTemplate()

Set the template

Parameter Name Type Description
$template array

Returns: bool

Top