Téléverser les fichiers vers "article-index-css"

This commit is contained in:
2025-11-17 19:14:38 +00:00
commit 009e1d0bcc
5 changed files with 166 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
<?php
require 'includes/db.php';
include 'includes/header.php';
$sql = "SELECT * FROM articles ORDER BY date_creation DESC LIMIT 10";
$stmt = $pdo->query($sql);
$articles = $stmt->fetchAll(PDO::FETCH_ASSOC);
?>
<h2>Derniers articles</h2>
<?php if (empty($articles)): ?>
<p>Aucun article pour le moment.</p>
<?php else: ?>
<?php foreach ($articles as $a): ?>
<h3><a href="article.php?id=<?= $a['id'] ?>"><?= htmlspecialchars($a['titre']) ?></a></h3>
<p><?= substr(htmlspecialchars($a['contenu']), 0, 150) ?>...</p>
<hr>
<?php endforeach; ?>
<?php endif; ?>
<?php include 'includes/footer.php'; ?>