Wallogit.com
2017 © Pedro Peláez
Class for HTML table
A html table generator, (*1)
A very light and simple class that genrate a html table from an array with values., (*2)
PHP 5 >= 5.3.0
Just create an object $ctable = new \phpe\HTMLTable\CTable();, (*3)
Then, if you want to change the table headers, write the following(if you dont want to, skip it):, (*4)
$table = $ctable->setTableHeading('array with names', 'css class name');, (*5)
To get the html table:, (*6)
$table = $ctable->getTable('array with values', 'css class name');, (*7)
Make it apart of $Di like:, (*8)
$di->setShared('ctable', function() { $ctable = new \phpe\HTMLTable\CTable(); return $ctable; });, (*9)
Then can you, depenending where in the code you want to reach CTable, reach the class whit either $app or $di; $app->ctable->getTable($anArray, 'cssClass'); or $this->di->ctable->getTable($anArray, 'cssClass');, (*10)