article
This commit is contained in:
0
article.php
Normal file
0
article.php
Normal file
32
index.php
32
index.php
@@ -9,9 +9,35 @@ $stmt->execute();
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr" dir="ltr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Blog</title>
|
||||
</head>
|
||||
<meta charset="UTF-8"> <title>Mon Blog</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Mini projet</h1>
|
||||
<p>Bienvenue . Voici les derniers articles :</p>
|
||||
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
while ($article = $stmt->fetch(PDO::FETCH_ASSOC)) :
|
||||
?>
|
||||
|
||||
<article>
|
||||
<h2><?php print htmlspecialchars($article['titre']); ?></h2>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
print htmlspecialchars(substr($article['contenu'], 0, 200));
|
||||
?>...
|
||||
</p>
|
||||
|
||||
<a href="article.php?id=<?php print $article['id']; ?>">Lire la suite</a>
|
||||
</article>
|
||||
<hr>
|
||||
|
||||
<?php
|
||||
endwhile;
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user