2017 © Pedro Peláez
 

library chtmltable

Class for creating HTML tables

image

paikz/chtmltable

Class for creating HTML tables

  • Thursday, May 12, 2016
  • by Paikz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Build Status Scrutinizer Code Quality Code Coverage, (*1)

CHTMLTable

CHTMLTable is a general PHP class used for creating simple html tables.Specifically written for Anax-MVC but can also be modified and used as a standalone class., (*2)

Installation

To install CHTMTable you need to add this snippet of code to your composer.json file., (*3)

  "require": {
        "php": ">=5.4",
        "paikz/chtmltable": "dev-master"
    },

Run this command in your Anax-MVC installation folder:, (*4)

php composer.phar install --no-dev

Assuming you have a clean installation of Anax-MVC you need to move the HTMLTable folder in vendor/paikz/chtmltable/src into app/src in your Anax-installation folder., (*5)

You can then move the test file from vendor/paikz/chtmltable/webroot into your Anax webroot. The test file is a very basic example of how a html table created with CHTMLTable can look like., (*6)

How to use

Creating a table is very easy. The method createTable($tableName, $tableHeaders, $tableData) takes three parameters., (*7)

$tableName represents the name of the table. Commonly used for styling purposes., (*8)

$tableHeaders represents the content of the table header-tags <th></th>., (*9)

$tableData represents the content of the table data-tags <td></td>., (*10)

Both $tableHeaders and $tableData are multidimensional arrays. It is very easy to create tables with fetched statements from a database with PDO. Just fetch an array and send it in $tableData., (*11)

A very simple example taken from the test file looks like this., (*12)

$table = $app->table->createTable(

  "testTable",

  [
    [
      'label' => 'Name',
    ],
    [
      'label' => 'Age',
    ],
    [
      'label' => 'Email',
    ],
  ],

  [
    [
      'name' => 'Philip Esmailzade',
      'age' => '19',
      'email' => 'test123@test.com',
    ],

    [
      'name' => 'test',
      'age' => '99',
      'email' => 'test321@test.com',
    ],
  ]

);
Name Age Email
Philip Esmailzade 19 test123@test.com
test 99 test321@test.com

License

This code is open-sourced software licensed under the MIT license, (*13)

The Versions

12/05 2016

dev-master

9999999-dev http://www.twitter.com/paikzz

Class for creating HTML tables

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php mvc html table htmltable

12/05 2016

V3.0

3.0.0.0 http://www.twitter.com/paikzz

Class for creating HTML tables

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php mvc html table htmltable

12/05 2016

v2.0

2.0.0.0 http://www.twitter.com/paikzz

Class for creating HTML tables

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php mvc html table htmltable

08/05 2016

v1.0

1.0.0.0 http://www.twitter.com/paikzz

Class for creating HTML tables

  Sources   Download

MIT

The Requires

  • php >=5.4

 

php mvc html table htmltable