Make the table look 1000% nicer

This commit is contained in:
Robert Miles 2018-07-19 10:44:08 -04:00
parent 79bd8d273a
commit 33ff6876ff
1 changed files with 9 additions and 6 deletions

View File

@ -4,13 +4,16 @@ include "header.php"; ?>
<h1>stats</h1>
<?php
$stats = json_decode(file_get_contents("stats.json"));
echo "\t<p>There are {$stats->usercount} users across {$stats->channelcount} channels.</p>\n";
echo "\t<table class='table'>\n\t\t<tr><th>Name</th><th>User count</th><th>Topic</th></tr>\n";
foreach($stats->channels as $channel) {
echo "\t<tr><td>{$channel->name}</td><td>{$channel->usercount}</td><td>{$channel->topic}</td></tr>\n";
}
echo "\t</table>\n";
?>
<p>There are <?=$stats->usercount?> users across <?=$stats->channelcount?> channels.</p>
<table class='table table-striped table-bordered'>
<thead><tr><th>Name</th><th>Users</th><th>Topic</th></tr></thead>
<tbody>
<?php foreach($stats->channels as $channel): ?>
<tr><td><?=$channel->name?></td><td><?=$channel->usercount?></td><td><?=$channel->topic?></td></tr>
<?php endforeach; ?>
</tbody>
</table>
<hr>
<p>Available in <a href="stats.json">JSON format</a>.</p>
<?php include "footer.php"; ?>