-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblogs.php
More file actions
20 lines (20 loc) · 747 Bytes
/
blogs.php
File metadata and controls
20 lines (20 loc) · 747 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
// blogs.php - simple blog listing for site news & creator posts
require_once __DIR__ . '/_includes/init.php';
require_once __DIR__ . '/_includes/header.php';
$pdo = km_db();
$stmt = $pdo->prepare("SELECT id,title,excerpt,created_at FROM blogs ORDER BY created_at DESC LIMIT 20");
$stmt->execute();
$rows = $stmt->fetchAll();
?>
<section class="panel">
<h2>Blogs</h2>
<?php foreach ($rows as $b): ?>
<article class="panel">
<h3><a href="/blog.php?id=<?= (int)$b['id'] ?>"><?= km_esc($b['title']) ?></a></h3>
<div class="km-retro-small"><?= km_esc($b['created_at']) ?></div>
<p><?= km_esc($b['excerpt']) ?></p>
</article>
<?php endforeach; ?>
</section>
<?php require_once __DIR__ . '/_includes/footer.php'; ?>