-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcategories.php
More file actions
35 lines (32 loc) · 1.01 KB
/
categories.php
File metadata and controls
35 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
session_start();
$pageTitle = 'Said Lagauit - Categories';
include 'init.php';
$categories = isset($_GET['category']) ? $_GET['category'] : '';
$categoryArticles = $con->prepare("SELECT `title`, `slug` FROM `articles` WHERE `categories` = :categories");
$categoryArticles->execute(array(':categories' => $categories));
echo '<h1 class="rounded-top text-md-center text-capitalize text-bg-dark mt-1 py-1">' . $categories . '</h1>';
?>
<div class="row">
<div class="col-md-4 text-md-center mx-auto">
<?php
if (!empty($categories)) {
while ($article = $categoryArticles->fetch(PDO::FETCH_ASSOC)) {
?>
<nav class="nav flex-column">
<li class="nav-item">
<a class="nav-link" href="index.php?do=reading&slug=<?php echo $article['slug'] ?>">
<?php echo $article['title']; ?>
</a>
</li>
</nav>
<?php
}
} else {
header('Location: index.php');
}
?>
</div>
</div>
<?php
include $tpl . 'footer.php'; ?>