-
Notifications
You must be signed in to change notification settings - Fork 2
/
news.php
523 lines (414 loc) · 22.8 KB
/
news.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
<?php include "includes/db.php"; ?>
<?php include "includes/functions.php"; ?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" type="image icon" href="https://res.cloudinary.com/sarabgi/image/upload/v1688669789/Assets/lplogo_bje93b.png">
<title>News | The City of Las Piñas</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<meta content="Free HTML Templates" name="keywords">
<meta content="Free HTML Templates" name="description">
<!-- Favicon -->
<!-- Google Web Fonts -->
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap" rel="stylesheet">
<!-- Font Awesome -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.0/css/all.min.css" rel="stylesheet">
<!-- Libraries Stylesheet -->
<link href="./Assets/newsassets/lib/owlcarousel/assets/owl.carousel.css" rel="stylesheet">
<!-- Customized Bootstrap Stylesheet -->
<link href="./Assets/newsassets/css/style.css" rel="stylesheet">
</head>
<body>
<!-- Header -->
<!-- Messenger Chat Plugin Code -->
<div id="fb-root"></div>
<!-- Your Chat Plugin code -->
<div id="fb-customer-chat" class="fb-customerchat">
</div>
<script>
var chatbox = document.getElementById('fb-customer-chat');
chatbox.setAttribute("page_id", "105339958124324");
chatbox.setAttribute("attribution", "biz_inbox");
</script>
<!-- Your SDK code -->
<script>
window.fbAsyncInit = function() {
FB.init({
xfbml: true,
version: 'v15.0'
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s);
js.id = id;
js.src = 'https://connect.facebook.net/en_US/sdk/xfbml.customerchat.js';
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<!-- Topbar Start -->
<div class="container-fluid">
<div class="row align-items-center bg-light px-lg-5">
<div class="col-12 col-md-8">
<div class="d-flex justify-content-between">
</div>
</div>
</div>
<audio id="newsspeech">
<source src="newsroom.mp3">
</audio>
<script>
window.addEventListener('DOMContentLoaded', function() {
var audio = document.getElementById("newsspeech");
var playLink = document.getElementById("playLinkN");
playLink.addEventListener('click', function(event) {
event.preventDefault();
audio.play();
});
});
</script>
<div class="row align-items-center py-2 px-lg-5">
<div class="col-lg-4">
<a href="#" id="playLinkN" class="navbar-brand d-none d-lg-block">
<h1 class="m-0 display-5 text-uppercase"><span class="text-primary"> </span>News<span class="text-primary">Room</span></h1>
</a>
</div>
<div class="col-lg-8 text-center text-lg-right">
<img class="img-fluid" src="./Assets/newsassets/img/ads-700x70.jpg" alt="">
</div>
</div>
</div>
<!-- Topbar End -->
<!-- Navbar Start -->
<div class="container-fluid p-0 mb-3">
<nav class="navbar navbar-expand-lg bg-light navbar-light py-2 py-lg-0 px-lg-5">
<a href="" class="navbar-brand d-block d-lg-none">
<h1 class="m-0 display-5 text-uppercase"><span class="text-primary"></span>News<span class="text-primary"></span></h1>
</a>
<button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbarCollapse">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-between px-0 px-lg-3" id="navbarCollapse">
<div class="navbar-nav mr-auto py-0">
<a href="index.php" class="nav-item nav-link">Home</a>
<a href="all_news_cat.php" class="nav-item nav-link">Categories</a>
<a href="all_featured.php" class="nav-item nav-link">Featured</a>
<a href="#popular" class="nav-item nav-link">Popular</a>
</div>
</div>
</nav>
</div>
<!-- Navbar End -->
<!-- Main News Slider Start -->
<div class="container-fluid py-3">
<div class="container">
<div class="row">
<div class="col-lg-8">
<div class="owl-carousel owl-carousel-2 carousel-item-1 position-relative mb-3 mb-lg-0">
<?php
if (isset($_GET['c_id'])) {
$the_cat_id = $_GET['c_id'];
$query = "SELECT * FROM posts WHERE post_category_id = $the_cat_id ORDER BY post_id DESC";
$select_all_post_query = mysqli_query($connection, $query);
if (!$select_all_post_query) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
} else {
$query = "SELECT * FROM posts ORDER BY post_id DESC";
$select_all_post_query = mysqli_query($connection, $query);
if (!$select_all_post_query) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
}
while ($row = mysqli_fetch_assoc($select_all_post_query)) {
$post_id = $row['post_id'];
$post_category_id = $row['post_category_id'];
$post_title = $row['post_title'];
$post_author = $row['post_author'];
$post_date = date("F j, Y", strtotime($row['post_date']));
// $post_date = strtotime($post_date);
$post_image = $row['post_image'];
$post_content = $row['post_content'];
$post_tags = $row['post_tags'];
$post_status = $row['post_status'];
$query = "SELECT * FROM categories WHERE cat_id = $post_category_id";
$select_all_cat_query = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($select_all_cat_query)) {
$post_category_id1 = $row['cat_id'];
$post_category_id = $row['cat_title'];
?>
<div class="position-relative overflow-hidden" style="height: 435px;">
<img class=" img-fluid h-100" src="<?php echo $post_image; ?>" style="object-fit: cover;">
<div class="overlay">
<div class="mb-1">
<a class="btn btn-sm btn-secondary rounded text-white" href=""><?php echo $post_category_id; ?></a>
<span class="px-2 text-white">/</span>
<a class="text-white" href=""><?php echo $post_date; ?></a>
</div>
<a class="h2 m-0 text-white font-weight-bold" href="singleNews.php?an_id=<?php echo $post_id ?>"><?php echo $post_title; ?></a>
</div>
</div>
<?php }
} ?>
</div>
</div>
<div class="col-lg-4">
<?php if (!empty($the_cat_id)) {
$query = "SELECT * FROM categories WHERE cat_id = $the_cat_id";
$select_all_cat_query = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($select_all_cat_query)) {
$post_category_id1 = $row['cat_id'];
$post_category_id = $row['cat_title'];
}
?>
<div class="input-group">
<div class="input-group-append">
<h3><span class="badge bg-primary"><?php echo $post_category_id; ?> <a href="news.php" class="btn btn-primary">X</a></span>
</h3>
</div>
</div>
<?php
} ?>
<div class="d-flex align-items-center justify-content-between bg-light py-2 px-4 mb-3">
<h3 class="m-0">Categories</h3>
<a class="text-secondary font-weight-medium text-decoration-none" href="all_news_cat.php">View All</a>
</div>
<?php
$query = "SELECT * FROM categories ORDER BY cat_id DESC LIMIT 4 ";
$select_all_cat = mysqli_query($connection, $query);
if (!$connection) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
while ($row = mysqli_fetch_assoc($select_all_cat)) {
$cat_id = $row['cat_id'];
$cat_title = $row['cat_title'];
$cat_image = $row['cat_image'];
?>
<div class="position-relative overflow-hidden mb-3" style="height: 80px;">
<img class="img-fluid w-100 h-100" src="<?php echo $cat_image; ?>" style="object-fit: cover;">
<a href="news.php?c_id=<?php echo $cat_id; ?>" class="overlay align-items-center justify-content-center h4 m-0 text-white text-decoration-none">
<?php echo $cat_title; ?>
</a>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<!-- Main News Slider End -->
<!-- Featured News Slider Start -->
<div class="container-fluid py-3">
<div class="container">
<div class="d-flex align-items-center justify-content-between bg-light py-2 px-4 mb-3">
<h3 class="m-0">Featured</h3>
<a class="text-secondary font-weight-medium text-decoration-none" href="all_featured.php">View All</a>
</div>
<div class="owl-carousel owl-carousel-2 carousel-item-4 position-relative">
<?php
if (isset($_GET['c_id'])) {
$the_cat_id = $_GET['c_id'];
$query = "SELECT * FROM posts WHERE post_category_id = $the_cat_id ORDER BY post_id DESC";
$select_all_post_query = mysqli_query($connection, $query);
if (!$select_all_post_query) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
} else {
$query = "SELECT * FROM posts ORDER BY post_id DESC";
$select_all_post_query = mysqli_query($connection, $query);
if (!$select_all_post_query) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
}
while ($row = mysqli_fetch_assoc($select_all_post_query)) {
$post_id = $row['post_id'];
$post_category_id = $row['post_category_id'];
$post_title = $row['post_title'];
$post_author = $row['post_author'];
$post_date = date("F j, Y", strtotime($row['post_date']));
$post_image = $row['post_image'];
$post_content = $row['post_content'];
$post_tags = $row['post_tags'];
$post_status = $row['post_status'];
$query = "SELECT * FROM categories WHERE cat_id = $post_category_id";
$select_all_cat_query = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($select_all_cat_query)) {
$post_category_id1 = $row['cat_id'];
$post_category_id = $row['cat_title'];
?>
<div class="position-relative overflow-hidden" style="height: 300px;">
<img class="img-fluid w-100 h-100" src="<?php echo $post_image; ?>" style="object-fit: cover;">
<div class="overlay">
<div class="mb-1" style="font-size: 13px;">
<a class="text-white" href=""><?php echo $post_category_id; ?></a>
<span class="px-1 text-white">/</span>
<a class="text-white" href=""><?php echo $post_date; ?></a>
</div>
<a class="h4 m-0 text-white" href="singleNews.php?an_id=<?php echo $post_id ?>"><?php echo $post_title; ?></a>
</div>
</div>
<?php }
} ?>
</div>
</div>
</div>
</div>
<!-- Featured News Slider End -->
<!-- News With Sidebar Start -->
<div class="container-fluid py-3" div data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-offset="0" class="scrollspy-example" tabindex="0">
<div class="container" id="popular">
<div class="row">
<div class="col-lg-8">
<div class="row mb-3">
<div class="col-12">
<div class="d-flex align-items-center justify-content-between bg-light py-2 px-4 mb-3">
<h3 class="m-0">Popular</h3>
</div>
</div>
<?php
if (isset($_GET['c_id'])) {
$the_cat_id = $_GET['c_id'];
$query = "SELECT * FROM posts WHERE post_category_id = $the_cat_id ORDER BY post_id DESC";
$select_all_post_query = mysqli_query($connection, $query);
if (!$select_all_post_query) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
$num_rows = mysqli_num_rows($select_all_post_query);
if ($num_rows == 0) {
echo "<div class='alert alert-danger alert-dismissible fade show' role='alert'>
<strong>Nothing is popular with this category.</strong>
<button type='button' class='close' data-dismiss='alert' aria-label='Close'>
<span aria-hidden='true'>×</span>
</button>
</div>";
}
} else {
$query = "SELECT * FROM posts ORDER BY post_views DESC LIMIT 2";
$select_all_post_query = mysqli_query($connection, $query);
if (!$select_all_post_query) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
}
while ($row = mysqli_fetch_assoc($select_all_post_query)) {
$post_id = $row['post_id'];
$post_category_id = $row['post_category_id'];
$post_title = $row['post_title'];
$post_author = $row['post_author'];
$post_date = date("F j, Y", strtotime($row['post_date']));
$post_image = $row['post_image'];
$post_content = $row['post_content'];
$post_tags = $row['post_tags'];
$post_desc = $row['post_desc'];
$post_status = $row['post_status'];
$query = "SELECT * FROM categories WHERE cat_id = $post_category_id";
$select_all_cat_query = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($select_all_cat_query)) {
$post_category_id = $row['cat_title'];
?>
<div class="col-lg-6">
<div class="position-relative mb-3">
<img class="img-fluid w-100" src="<?php echo $post_image; ?>" style="object-fit: cover; height: 350px;">
<div class="overlay position-relative bg-light">
<div class="mb-2" style="font-size: 14px;">
<a href="" class="text-dark"><?php echo $post_category_id; ?></a>
<span class="px-1">/</span>
<span><?php echo $post_date; ?></span>
</div>
<a class="h4" href="singleNews.php?an_id=<?php echo $post_id ?>"><?php echo $post_title; ?></a>
<p class="m-0"><?php echo $post_desc; ?></p>
</div>
</div>
</div>
<?php }
} ?>
</div>
<div class="mb-3 pb-3">
<a href=""><img class="img-fluid w-100" src="./Assets/newsassets/img/ads-700x70.jpg" alt=""></a>
</div>
</div>
<!-- Ads Start -->
<div class="col-lg-4 pt-3 pt-lg-0">
<div class="d-flex align-items-center justify-content-between bg-light py-2 px-4 mb-3">
<h3 class="m-0">Advertisements</h3>
</div>
<div class="owl-carousel owl-carousel-2 carousel-item-1 position-relative mb-3 mb-lg-0">
<?php
$query = "SELECT * FROM ads ";
$select_all_ads = mysqli_query($connection, $query);
if (!$connection) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
while ($row = mysqli_fetch_assoc($select_all_ads)) {
$ads_id = $row['ads_id'];
$ads_title = $row['ads_title'];
$ads_image = $row['ads_image'];
$ads_link = $row['ads_link'];
?>
<div class="position-relative overflow-hidden" style="height: 335px;">
<img class=" img-fluid h-100" src="<?php echo $ads_image; ?>" style="object-fit: cover;">
<div class="overlay">
<a class="h2 m-0 text-white font-weight-bold" href="<?php echo $ads_link ?>" target="_blank"><?php echo $ads_title; ?></a>
</div>
</div>
<?php } ?>
</div>
<div class="owl-carousel owl-carousel-2 carousel-item-1 position-relative mb-3 mb-lg-0">
<?php
$query = "SELECT * FROM ads ORDER BY ads_id DESC";
$select_all_ads = mysqli_query($connection, $query);
if (!$connection) {
die("CONNECTION FAILED" . " " . mysqli_error($connection));
}
while ($row = mysqli_fetch_assoc($select_all_ads)) {
$ads_id = $row['ads_id'];
$ads_title = $row['ads_title'];
$ads_image = $row['ads_image'];
$ads_link = $row['ads_link'];
?>
<div class="position-relative overflow-hidden" style="height: 335px;">
<img class=" img-fluid h-100" src="<?php echo $ads_image; ?>" style="object-fit: cover;">
<div class="overlay">
<a class="h2 m-0 text-white font-weight-bold" href="<?php echo $ads_link ?>" target="_blank"><?php echo $ads_title; ?></a>
</div>
</div>
<?php } ?>
</div>
<!-- Ads End -->
</div>
</div>
</div>
</div>
</div>
<!-- News With Sidebar End -->
<!-- Footer Start -->
<div class="container-fluid bg-light pt-5 px-sm-3 px-md-5">
<div class="row">
<div class="col-lg-3 col-md-6 mb-5">
<a href="#" class="navbar-brand">
<h1 class="mb-2 mt-n2 display-5 text-uppercase"><span class="text-primary"> </span>News<span class="text-primary">Room</span></h1>
</a>
</div>
</div>
</div>
<div class="container-fluid py-4 px-sm-3 px-md-5">
<p class="m-0 text-center">
© <a class="font-weight-bold" href="#">News Room</a>. All Rights Reserved.
</p>
</div>
<!-- Footer End -->
<!-- Back to Top -->
<a href="#" class="btn btn-dark back-to-top"><i class="fa fa-angle-up"></i></a>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script src="./Assets/newsassets/lib/easing/easing.js"></script>
<script src="./Assets/newsassets/lib/owlcarousel/owl.carousel.min.js"></script>
<!-- Contact Javascript File -->
<script src="./Assets/newsassets/mail/jqBootstrapValidation.min.js"></script>
<script src="./Assets/newsassets/mail/contact.js"></script>
<!-- Template Javascript -->
<script src="./Assets/newsassets/js/main.js"></script>
</body>
</html>