-
Notifications
You must be signed in to change notification settings - Fork 2
/
popular.php
174 lines (155 loc) · 7.78 KB
/
popular.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
//disabling error reporting
error_reporting(0);
//including database file
require_once 'connection/db.php';
// querying for the Popular category
$query = "SELECT * FROM posts WHERE post_category = ? ORDER BY post_date LIMIT 8";
$lat_cat = 'Popular';
$stmt = $conn->prepare($query);
$stmt->bind_param('s',$lat_cat);
$stmt->execute();
$Popular = $stmt->get_result();
$stmt->close();
// second querying for the Popular category
$query = "SELECT * FROM posts WHERE post_category = ? ORDER BY post_date LIMIT 8,8";
$sec_cat = 'Popular';
$stmt = $conn->prepare($query);
$stmt->bind_param('s',$sec_cat);
$stmt->execute();
$second_cat = $stmt->get_result();
$stmt->close();
// querying for the Popular category for sliding posts
$query = "SELECT * FROM posts WHERE post_category = ? ORDER BY post_date LIMIT 5";
$sli_cat = 'Popular';
$stmt = $conn->prepare($query);
$stmt->bind_param('s',$sli_cat);
$stmt->execute();
$sliding = $stmt->get_result();
$stmt->close();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="">
<meta name="keywords" content=" latest news,latest news today,top news, current news, news today, news now">
<meta property="og:title" content="The number one naija blog for the latest sports and current news">
<meta property="og:description" content="Home of all latest , current and world current news">
<meta property="og:image" content="https://unitechdev.com/image/ogimage.jpg">
<meta property="og:url" content="https://unitechdev.com">
<meta property="og:type" content="blog">
<meta property="twitter:title" content="The number one for the latest sports and current news">
<meta property="twitter:description" content="Home of all latest , current and world current news">
<meta property="twitter:image" content="https://unitechdev.com/image/ogimage.jpg">
<meta property="twitter:url" content="https://unitechdev.com">
<meta property="twitter:card" content="summary_large_image">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/all.css">
<link rel="stylesheet" href="css/swiper.min.css">
<title>Niger Latest</title>
</head>
<body>
<!--including topbar-->
<?php include 'includes/topbar.php';?>
<!-- swiper sliding posts page-->
<div class="swiper-container swipe1">
<div class="swiper-wrapper">
<?php while ($result = $sliding->fetch_assoc()) {
$explode = explode("../",$result['image_dir']);
?>
<div class="swiper-slide">
<a href="viewpost?vid=<?php echo $result['id'];?>"><img src="<?= $explode[1]?>" alt="sliding image" class="img-fluid card-img-top">
<div class="card-title bg-danger ml-4 text-center" id="caption">
<p class="text-white"><?php echo $result['post_desc'];?></p>
</div></a>
</div>
<?php }?>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination"></div>
</div>
<section id="section">
<div class="container">
<div class="row">
<!--first column-->
<div class="col-md-6">
<?php while ($result = $Popular->fetch_assoc()) {
$explode = explode("../",$result['image_dir']);
?>
<h1><?php echo $result['post_title'];?></h1>
<div class="card shadow my-3">
<div>
<img src="<?= $explode[1];?>" class="img-fluid card-img-top" alt="post image">
</div>
<div class="card body p-2">
<h3 class="card-title"><?php echo strip_tags($result['post_desc']); ?></h3>
<small class="text-left"><span class="fas fa-clock text-primary "></span> <?php echo $result['post_date'];?></small>
<small class="text-right"><i>Posted by </i><?php echo $result['post_author'];?></small>
<a href="viewpost?vid=<?php echo $result['id'];?>" class="btn btn-primary btn-sm">Read More</a>
</div>
</div>
<?php }?>
</div><br>
<!--second column-->
<div class="col-md-6">
<div class="list-group" style="margin:40px 0 10px 0;">
<a href="#" class="list-group-item active">Categories</a>
<a href="latest" class="list-group-item">Latest </a>
<a href="popular" class="list-group-item primary">Popular</a>
<a href="politics" class="list-group-item">politics </a>
<a href="sports" class="list-group-item">Sports </a>
<a href="education" class="list-group-item">Education </a>
<a href="#" class="list-group-item">Other News </a>
</div>
<?php while ($result = $second_cat->fetch_assoc()) {?>
<div class="card shadow my-3">
<div>
<img src="<?php echo $result['image_dir'];?>" class="img-fluid card-img-top" alt="post image">
</div>
<div class="card-body p-2">
<h3 class="card-title"><?php echo strip_tags($result['post_desc']);?></h3>
<small class="text-left"><span class="fas fa-clock text-primary "></span> <?php echo $result['post_date'];?></small><br>
<small class="text-right"><i>Posted by </i><?php echo $result['post_author'];?></small>
<a href="viewpost?vid=<?php echo $result['id'];?>" class="btn btn-primary btn-sm">Read More</a>
</div>
</div>
<?php }?>
</div>
</div>
</div>
</section>
<!-- bootstrap modal -->
<?php include 'includes/blog_modal.php'; ?>
<!-- bootstrap modal ends -->
<!-- footer section--->
<footer class="footer footer-default" style="height: auto; width: 100%; background-color:black;padding-top:15px;color:gray; ">
<p class="text-center">Copyright © 2020 All rights reserved | Developed by <span><a style="text-decoration:none;color:red;" href="www.unitechdev.com">Unitech</a><span></p>
</footer>
<script src="js/jquery.min.js"></script>
<script src="js/swiper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script>
/* posts slide*/
var swiper = new Swiper('.swipe1', {
spaceBetween: 30,
effect: 'fade',
autoplay: {
display:1500,
diableOnInteraction: false,
},
pagination: {
el: '.swiper-pagination',
type: 'progressbar',
clickable: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
</script>
</body>
</html>