AJOUT CMS
This commit is contained in:
41
index.php
Normal file
41
index.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
require 'include/db.php';
|
||||
$stmt = $pdo->query('SELECT * FROM articles ORDER BY date_creation DESC LIMIT 10');
|
||||
$articles = $stmt->fetchAll();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Accueil - CMS Simplifié</title>
|
||||
<link rel="stylesheet" href="assets/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="index.php">Accueil</a> |
|
||||
<a href="admin/login.php">Administration</a>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<h1>Articles récents</h1>
|
||||
<?php if (empty($articles)): ?>
|
||||
<p>Aucun article n'a encore été publié.</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php foreach ($articles as $a): ?>
|
||||
<article>
|
||||
<h2><a href="article.php?id=<?= $a['id'] ?>"><?= htmlspecialchars($a['titre']) ?></a></h2>
|
||||
<small>Publié le <?= date('d/m/Y', strtotime($a['date_creation'])) ?></small>
|
||||
<p><?= substr(htmlspecialchars($a['contenu']), 0, 200) ?>...</p>
|
||||
<p><a href="article.php?id=<?= $a['id'] ?>">Lire la suite...</a></p>
|
||||
</article>
|
||||
<?php endforeach; ?>
|
||||
</main>
|
||||
|
||||
<footer>
|
||||
<p>© <?= date('Y') ?> CMS Simplifié. Tous droits réservés.</p>
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user