Premier commit
This commit is contained in:
18
index.php
Normal file
18
index.php
Normal file
@@ -0,0 +1,18 @@
|
||||
#<?php
|
||||
require_once __DIR__ . '/includes/db.php';
|
||||
require_once __DIR__ . '/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");
|
||||
|
||||
echo "<h2>Derniers articles</h2>";
|
||||
|
||||
while ($row = $stmt->fetch()) {
|
||||
echo "<article>";
|
||||
echo "<h3><a href='article.php?id={$row['id']}'>{$row['titre']}</a></h3>";
|
||||
echo "<p>{$row['extrait']}...</p>";
|
||||
echo "<small>Publié le {$row['date_creation']}</small>";
|
||||
echo "</article><hr>";
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/includes/footer.php';
|
||||
Reference in New Issue
Block a user