-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcategory-posts.php
182 lines (142 loc) · 8.19 KB
/
category-posts.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
175
176
177
178
179
180
181
182
<?php session_start();
include_once('includes/config.php'); ?>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Blog Management System</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/owl.carousel.css">
<link rel="stylesheet" href="css/owl.theme.default.min.css">
<!-- MAIN CSS -->
<link rel="stylesheet" href="css/style.css">
</head>
<body id="top" data-spy="scroll" data-target=".navbar-collapse" data-offset="50">
<?php include_once('includes/header.php') ?>
<?php
$catname=$_GET['catname'];
$catid=$_GET['catid'];
?>
<section>
<div class="container">
<div class="text-center">
<h1><?php echo $catname;?> Blog Posts</h1>
</div>
</div>
</section>
<section class="section-background">
<div class="container">
<div class="row">
<?php include_once('includes/sidebar.php');?>
<div class="col-lg-9 col-xs-12">
<div class="row">
<?php
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
} else {
$pageno = 1;
}
$no_of_records_per_page = 8;
$offset = ($pageno-1) * $no_of_records_per_page;
$total_pages_sql = "SELECT COUNT(*) FROM tblposts where tblposts.CategoryId='$catid' and tblposts.Is_Active=1";
$result = mysqli_query($con,$total_pages_sql);
$total_rows = mysqli_fetch_array($result)[0];
$total_pages = ceil($total_rows / $no_of_records_per_page);
$query=mysqli_query($con,"select tblposts.postedBy ,tblposts.viewCounter,tblposts.id as pid,tblposts.PostTitle as posttitle,tblposts.PostImage,tblcategory.CategoryName as category,tblcategory.id as cid,tblsubcategory.Subcategory as subcategory,tblposts.PostDetails as postdetails,tblposts.PostingDate as postingdate,tblposts.PostUrl as url from tblposts left join tblcategory on tblcategory.id=tblposts.CategoryId left join tblsubcategory on tblsubcategory.SubCategoryId=tblposts.SubCategoryId where tblposts.Is_Active=1 and tblposts.CategoryId='$catid' order by tblposts.id desc LIMIT $offset, $no_of_records_per_page");
while ($row=mysqli_fetch_array($query)) {
?>
<div class="col-sm-6" style="height:550px;">
<div class="courses-thumb courses-thumb-secondary">
<div class="courses-top">
<div class="courses-image">
<img src="admin/postimages/<?php echo htmlentities($row['PostImage']);?>" alt="<?php echo htmlentities($row['posttitle']);?>" width="400" height="300">
</div>
<div class="courses-date">
<span title="Author"><i class="fa fa-user"></i> <?php echo htmlentities($row['postedBy']);?></span>
<span title="Date"><i class="fa fa-calendar"></i> <?php echo htmlentities($row['postingdate']);?></span>
<span title="Views"><i class="fa fa-eye"></i> <?php echo htmlentities($row['viewCounter']);?></span>
</div>
</div>
<div class="courses-detail">
<h3><a href="blog-post-details.php?bid=<?php echo htmlentities($row['pid'])?>"><?php echo htmlentities($row['posttitle']);?></a></h3>
</div>
<div class="courses-info">
<a href="blog-post-details.php?bid=<?php echo htmlentities($row['pid'])?>" class="section-btn btn btn-primary btn-block">Read More</a>
</div>
</div>
</div>
<?php } ?>
</div>
<!-- Pagination -->
<ul class="pagination justify-content-center mb-4">
<li class="page-item"><a href="?pageno=1" class="page-link">First</a></li>
<li class="<?php if($pageno <= 1){ echo 'disabled'; } ?> page-item">
<a href="<?php if($pageno <= 1){ echo '#'; } else { echo "?pageno=".($pageno - 1); } ?>" class="page-link">Prev</a>
</li>
<li class="<?php if($pageno >= $total_pages){ echo 'disabled'; } ?> page-item">
<a href="<?php if($pageno >= $total_pages){ echo '#'; } else { echo "?pageno=".($pageno + 1); } ?> " class="page-link">Next</a>
</li>
<li class="page-item"><a href="?pageno=<?php echo $total_pages; ?>" class="page-link">Last</a></li>
</ul>
</div>
</div>
</div>
</section>
<!-- FOOTER -->
<?php include_once('includes/footer.php') ?>
<div class="modal fade bs-example-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="gridSystemModalLabel">Book Now</h4>
</div>
<div class="modal-body">
<form action="#" id="contact-form">
<div class="row">
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Pick-up location" required>
</div>
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Return location" required>
</div>
</div>
<div class="row">
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Pick-up date/time" required>
</div>
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Return date/time" required>
</div>
</div>
<input type="text" class="form-control" placeholder="Enter full name" required>
<div class="row">
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Enter email address" required>
</div>
<div class="col-md-6">
<input type="text" class="form-control" placeholder="Enter phone" required>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="section-btn btn btn-primary">Book Now</button>
</div>
</div>
</div>
</div>
<!-- SCRIPTS -->
<script src="js/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/owl.carousel.min.js"></script>
<script src="js/smoothscroll.js"></script>
<script src="js/custom.js"></script>
</body>
</html>