Téléverser les fichiers vers "article-index-css"
This commit is contained in:
22
article-index-css/index.php
Normal file
22
article-index-css/index.php
Normal 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'; ?>
|
||||
Reference in New Issue
Block a user