donami / ctable
Table management
v1.0
2016-05-05 10:34 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-11-15 19:26:46 UTC
README
CTable - Table module for Anax
CTable is a module for Anax used for creating HTML Tables in an easy manner.
How to:
Install CTable by using composer:
composer require donami/ctable
Usage:
Create a HTML table from array
Use an array to create the table:
$di->set('HTMLTable', 'donami\CTable\CTable'); $data = array( array('First', 'Second', 'Third'), array('Fourth', 'Fifth', 'Sixth') ); echo $app->HTMLTable->generate($data);
Will output:
<table> <tr> <td>First</td> <td>Second</td> <td>Third</td> </tr> <tr> <td>Fourth</td> <td>Fifth</td> <td>Sixth</td> </tr> </table>
One by one
This is useful when looping through data
$di->set('HTMLTable', 'donami\CTable\CTable'); $app->HTMLTable->create_row(array('First', 'Second', 'Third')); $app->HTMLTable->create_row(array('Fourth', 'Fifth', 'Sixth')); echo $app->HTMLTable->generate();
Defining tags:
Used for customizing the style of the table.
Example: Set the background of the table to purple
$app->HTMLTable->defineTags(array('table_start' => '<table style="background: purple">'));
Links: Packagist: https://packagist.org/packages/donami/ctable