-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcategory.php
executable file
·115 lines (109 loc) · 4.74 KB
/
category.php
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
include("./library/db.php");
$site_data_qry = mysqli_query($conn, "SELECT * FROM `site_settings` Where id='1'");
$site_data = mysqli_fetch_assoc($site_data_qry);
include("library/function.php");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- CSS only -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.2/font/bootstrap-icons.css">
<!-- Favicon -->
<link rel="apple-touch-icon" sizes="57x57" href="assets/img_site/fav/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/img_site/fav/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/img_site/fav/apple-touch-icon.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/img_site/fav/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="192x192" href="assets/img_site/fav/android-chrome-192x192.png">
<link rel="icon" type="image/png" sizes="512x512" href="assets/img_site/fav/android-chrome-512x512.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/img_site/fav/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="assets/img_site/fav/favicon.ico">
<link rel="icon" type="image/png" sizes="16x16" href="assets/img_site/fav/favicon-16x16.png">
<meta name="theme-color" content="#ffffff">
<!-- Fav End -->
<meta name="robots" content="follow, index" />
<!-- canonical url -->
<link rel="canonical"
href="<?= $baseurl ?>category/<?php if (!isset($_GET['cat_name'])) {
} elseif (isset($_GET['cat_name'])) {
echo $_GET['cat_name'];
} ?>">
<title><?php if (!isset($_GET['cat_name'])) {} elseif (isset($_GET['cat_name'])) {echo $_GET['cat_name'];} ?> Categories - <?= $site_data['site_name'] ?></title>
</head>
<body>
<?php
include('./library/includes/navbar.php');
?>
<?php
if (!isset($_GET['cat_name'])) {
} elseif (isset($_GET['cat_name'])) {
?>
<center>
<div class="card">
<div class="card-body">
<h1>
<?= $_GET['cat_name'] ?>
</h1>
</div>
</div>
</center>
<?php
}
?>
<section id="lists">
<div class="container">
<div class="row gx-2">
<?php
if (!isset($_GET['cat_name'])) {
$sql_qry = $conn->query("SELECT * FROM `menus_navbar` ORDER BY `name` ASC");
if ($sql_qry->num_rows > 0) {
while ($assoc_cat = $sql_qry->fetch_assoc()) {
?>
<a href="<?= $baseurl ?>category_sm/<?= $assoc_cat['link'] ?>"
class="text-decoration-none col-3 my-2 text-center">
<div class="card">
<div class="card-body">
<h1>
<?= $assoc_cat['name'] ?>
</h1>
</div>
</div>
</a>
<?php
}
}
} elseif (isset($_GET['cat_name'])) {
$cat_name = $_GET['cat_name'];
$sql_post = $conn->query("SELECT * FROM `posts` Where `post_cat`='$cat_name' ORDER BY `time` DESC");
if ($sql_post->num_rows > 0) {
while ($post_fetch = $sql_post->fetch_assoc()) {
?>
<a href="<?= $baseurl ?>post/<?= catStraper($conn, $post_fetch['post_cat']) ?>/<?= $post_fetch['postSlug'] ?>"
class="text-decoration-none col-6 my-2 text-center">
<div class="card">
<div class="card-body">
<?= $post_fetch['post_title'] ?>
</div>
</div>
</a>
<?php
}
} else {
echo ("This Category Doesn't contain any posts");
}
}
?>
</div>
</div>
</section>
<!-- JavaScript Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"
integrity="sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4"
crossorigin="anonymous"></script>
</body>
</html>