|
As of TableHelpers v1.1, you can easily enable click-sorting by setting the enableSort property and using loadQuery like:
<?
$table1 = new TableSet();
$table1->enableSort = true;
$table1->loadQuery(
"SELECT advertiser AS 'The Advertiser',"
. "clicks AS 'Clicks',"
. "impressions AS 'Impressions',"
. "DATE_FORMAT(date, '%b %D') AS 'Day' "
. "FROM ffce_traffic"
);
echo $table1->getTableTag();
?>
Generates:
| The Advertiser |
Clicks |
Impressions |
Day |
www.redgeoff.com |
12 |
78 |
Mar 8th |
www.redgeoff.com |
10 |
100 |
Mar 7th |
www.urshelf.com |
40 |
234 |
Mar 8th |
www.urshelf.com |
50 |
300 |
Mar 7th |
www.mymusicband.com |
150 |
510 |
Mar 7th |
| |