18 lines
565 B
PHP
18 lines
565 B
PHP
<?php
|
|
global $c;
|
|
$varPostLocations = $c->query("SELECT distinct location from posts order by location");
|
|
?>
|
|
|
|
<div>
|
|
<label>Directory</label>
|
|
</div>
|
|
|
|
<ul>
|
|
<?php foreach ($varPostLocations as $i): ?>
|
|
<?php
|
|
$intPostCount = $c->query("SELECT count(*) as c from posts where location = ?", $i["location"])[0]["c"];
|
|
?>
|
|
<li><a href="<?= $i["location"]; ?>"><?= $i["location"]; ?></a> <small>— <?= $intPostCount !== 1? "{$intPostCount} posts": "{$intPostCount} post"; ?></small></li>
|
|
<?php endforeach; ?>
|
|
</ul>
|