donami/ctable

Table management

Installs: 17

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 1

Language:HTML

v1.0 2016-05-05 10:34 UTC

This package is not auto-updated.

Last update: 2024-11-15 19:26:46 UTC


README

Travis build status Scrutinizer Code Quality Code Coverage

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