-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
94 lines (85 loc) · 2.8 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
<?php
include "inc/header.php";
?>
<!-- pagination-->
<?php
$total_page = 2;
if(isset($_GET["page"])){
$page = $_GET["page"];
}else {
$page = 1;
}
$start_form = ($page-1) * $total_page;
?>
<!-- pagination-->
<!-- header-bottom -->
<div class="header-bottom">
<?php include "inc/social.php"; ?>
<?php include "inc/slider.php"; ?>
<div class="clearfix"> </div>
<!-- blog -->
<div class="blog">
<div class="blog-left">
<?php
$sql = "SELECT * FROM `tbl_recipe` WHERE status = 'Approve' order by `recipe_id` DESC limit $start_form, $total_page";
$post = $db_conn->read($sql);
if($post){
while($row = $post->fetch_assoc()){ //Start while loop
?>
<div class="blog-left-grid">
<div class="blog-left-grid-left">
<h3><a href="singlePost.php?id=<?php echo $row['recipe_id'];?>"><?php echo $row['recipe_title'];?></a></h3>
<p>by <span><?php echo $row['recipe_author'];?></span> | <?php echo $l_method->formatDate($row['Date']);?> | <span><?php echo $row['recipe_tags'];?></span></p>
</div>
<div class="blog-left-grid-right">
<a href="#" class="hvr-bounce-to-bottom non">TotalView: <?php echo $row['views'];?></a>
</div>
<div class="clearfix"> </div>
<!--Image-->
<div class="col-lg-6 col-md-4 col-sm-6 col-xs-12">
<div class="hovereffect">
<img class="img-responsive" src="images/<?php echo $row['recipe_image'];?>" alt="Recipe Image">
<div class="overlay">
<a class="info" href="singlePost.php?id=<?php echo $row['recipe_id'];?>">View Recipe</a>
</div>
</div>
</div>
<div class="clearfix"> </div>
<!--Post body-->
<p class="para"><?php echo $l_method->textShorten($row['recipe_desc']);?></p>
<div class="rd-mre">
<a href="singlePost.php?id=<?php echo $row['recipe_id'];?>" class="hvr-bounce-to-bottom quod">Read More</a>
</div>
</div>
<?php }?><!--End While loop-->
<?php }else {?>
<div class="blog-left-grid-left">
<h3>Nothing to Show!!!</h3>
</div>
<?php }?><!--End IF ELSE-->
<!--Start pagination-->
<?php
$sql = "select * from tbl_recipe";
$result = $db_conn->read($sql);
if($result){
$total_rows = mysqli_num_rows($result);
$total_pages = ceil($total_rows/$total_page);
echo "<span class='pagination'><a class='hvr-bounce-to-bottom non' href='index.php?page=1'>First Page</a>";
for($i=1; $i<=$total_pages; $i++){
echo "<a class='hvr-bounce-to-bottom non' href='index.php?page=".$i."'>".$i."</a>";
}
echo "<a class='hvr-bounce-to-bottom non' href='index.php?page=$total_pages'>Last Page</a></span>";
}
?>
<!--End pagination-->
</div>
<?php include "inc/sidebar.php"; ?>
<div class="clearfix"> </div>
</div>
<!-- //blog -->
</div>
<!-- //header-bottom -->
</div>
</div>
<!-- //banner-body -->
<?php include "inc/footer.php"; ?>