Refonte complète du projet
This commit is contained in:
18
public/index.php
Normal file
18
public/index.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?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'; ?>
|
||||
Reference in New Issue
Block a user