-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
106 lines (89 loc) · 3.27 KB
/
index.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
<?php
require_once "view/header.php";
require_once "core/initad.php";
// pagination
$jumlahDataPerhalaman = 6;
$jumlahData = count(query("SELECT * FROM populer "));
$jumlahHalaman = ceil($jumlahData / $jumlahDataPerhalaman);
$halamanAktif = (isset($_GET['halaman']) ? $_GET['halaman'] : 1);
$awalData = ($jumlahDataPerhalaman * $halamanAktif) - $jumlahDataPerhalaman;
$wisata = query("SELECT * FROM populer LIMIT $awalData, $jumlahDataPerhalaman");
if (isset($_POST['cari'])) {
$wisata = cari($_POST["keyword"]);
}
?>
<header id="gtco-header" class="gtco-cover gtco-cover-sm" role="banner" style="background-image: url(view/images/bandung.png)">
<div class="overlay"></div>
<div class="gtco-container">
<div class="row">
<div class="col-md-12 col-md-offset-0 ">
<div class="row row-mt-16em">
<br>
<div class="col-md-12 mt-text animate-box" data-animate-effect="fadeInUp">
<h1>Rencanakan Liburan anda <br> di Bandung!</h1>
</div>
</div>
</div>
</div>
</div>
</header>
<div class="gtco-section">
<div class="gtco-container">
<div class="row">
<div class="col-md-8 col-md-offset-2 text-center gtco-heading">
<br>
<h2>Perjalanan Dengan Destinasi Favorit Anda</h2>
<p>Dignissimos asperiores vitae velit veniam totam fuga molestias accusamus alias autem provident. Odit ab aliquam dolor eius.</p>
<br>
<!-- searching -->
<form class="form-inline" action="" method="post">
<button type="submit" name="cari" class="btn btn-primary mb-2">Cari</button>
<div class="form-group mx-3 mb-2">
<label for="cari" class="sr-only">cari</label>
<input type="text" name="keyword" class="form-control" id="cari" size="70" placeholder="cari disini...">
</div>
</form>
</div>
</div>
<div class="row">
<? $i = 0; ?>
<?php foreach ($wisata as $row) : ?>
<div class="col-lg-4 col-md-4 col-sm-6">
<div class="card" style="width: 18rem;">
<img class="card-img-top" src="admin/img/<?= $row["gambar"]; ?>" alt="Card image cap" width="286px" height="178px">
<br><br>
<div class="card-body">
<h5 class="card-title"><b><?= $row["judul"]; ?></b></h5>
<p class="card-text"><?= excerpt($row["isi"]); ?></p>
<a href="detailpopuler.php?id=<?= $row['id']; ?>" class="btn btn-primary">Info Detail</a>
</div>
</div>
</div>
<? $i++; ?>
<?php endforeach; ?>
</div>
</div>
<br><br>
<div class="pagination col-md-11 col-md-offset-2 text-center gtco-heading">
<nav aria-label="Page navigation example">
<ul class="pagination ">
<?php if ($halamanAktif > 1) : ?>
<li class="page-item"><a class="page-link" href="?halaman=<?= $halamanAktif - 1; ?>">Previous</a></li>
<?php endif; ?>
<?php for ($i = 1; $i <= $jumlahHalaman; $i++) : ?>
<?php if ($i == $halamanAktif) : ?>
<li class="disabled"><a href="?halaman=<?= $i; ?>"><?= $i; ?></a></li>
<?php else : ?>
<li class="page-item"><a class="page-link" href="?halaman=<?= $i; ?>"><?= $i; ?></a></li>
<?php endif; ?>
<?php endfor; ?>
<?php if ($halamanAktif < $jumlahHalaman) : ?>
<li class="page-item"><a class="page-link" href="?halaman=<?= $halamanAktif + 1; ?>">Next</a></li>
<?php endif; ?>
</ul>
</nav>
</div>
</div>
<?php
require_once "view/footer.php";
?>