19 lines
624 B
PHP
19 lines
624 B
PHP
<?php
|
|
require_once '../includes/db.php';
|
|
require_once '../includes/header.php';
|
|
|
|
$stmt = $pdo->query("SELECT id, titre, SUBSTRING(contenu,1,150) AS extrait, date_creation
|
|
FROM articles ORDER BY date_creation DESC LIMIT 10");
|
|
?>
|
|
<h2>Derniers articles</h2>
|
|
<?php while ($row = $stmt->fetch()): ?>
|
|
<article>
|
|
<h3><a href="article.php?id=<?= $row['id'] ?>"><?= htmlspecialchars($row['titre']) ?></a></h3>
|
|
<p><?= htmlspecialchars($row['extrait']) ?>...</p>
|
|
<small>Publié le <?= $row['date_creation'] ?></small>
|
|
</article>
|
|
<hr>
|
|
<?php endwhile; ?>
|
|
|
|
<?php require_once '../includes/footer.php'; ?>
|