1. Go to this page and download the library: Download bugo/smf-bricks library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$builder = TableBuilder::make('table_id', 'Table title')
->withParams(
perPage: 10,
noItemsLabel: 'There is no data yet',
action: $context['canonical_url'],
defaultSortColumn: 'id'
)
->setItems($this->getData(...)) // You can also use arrays: [$this, 'getData']
->setCount($this->getNumData(...)) // You can also use arrays: [$this, 'getNumData']
->addColumn(IdColumn::make());
$renderer = new TableRenderer();
$presenter = new TablePresenter($renderer);
$presenter->show($builder);
Column::make('column_name', 'Column Header')
->setClass('CSS class for the column')
->setStyle('CSS style for the column')
->setData('key in the array returned by the getData method', 'CSS class for the data cell')
->setSort('column_name', 'column_name DESC'),