, (*1)
HTMLtable
Use HTMLtable to create and show tables with or without pagination., (*2)
This module was made in the course phpmvc.
It was made for use with Anax-MVC but can be use in simpler ways too., (*3)
Install in Anax
Add to your composer.json file with require., (*4)
"require": {
...
"kri/chtmltable": "dev-master"
}
Run composer install --no-dev or composer update --no-dev to get kri/chtmltable.
It is also possible to test HTMLtable outside of the vendor folder. Copy the table-anax-style.php file to your webroot and point your browser there., (*5)
Usage
First you have to create a table object in your pagecontroller., (*6)
Anax
In Anax you can add it with DI like this: di->set('table', '\Kri\HTMLtable\CHTMLtable');, (*7)
Then its ready to be used. The function takes 4 options., (*8)
- $td is the array with data to generate a table of.
- $th is an optional array and displays table headings.
- Next is a optional boolean value if you want to generate pagering true/false, default is false.
- If you choose to enable pagering the last value is how many rows/indexes to display per page.
Example: $app->table->getTable($td, $th, true, 3)
Full example can be found in chtmltable/webroot/page-anax-style.php., (*9)
Outside Anax
Another simpler way off adding it is to create the object like this: $table = new kri\HTMLTable\CHTMLTable();, (*10)
Then use it the same way as in Anax: $table->getTable($td, $th, true, 3);
Full example can be found in chtmltable/webroot/page-with-table.php and page-with-table-pagering.php., (*11)
About
Requirements
- PHP 5.4 or above
-
Anax-MVC (for use with Anax)
Author
KriRin, (*12)
License
MIT- See LICENSE.txt file., (*13)