-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.php
122 lines (105 loc) · 3.42 KB
/
categories.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
<?php
session_start();
include 'init.php';
$pageTitle = 'أقسام - ' . $_GET['page_title'];
// get header
$hook_up->inc_header();
$page_id = isset($_GET['pageid']) ? $_GET['pageid'] : "";
// get posts
require_once 'pagination-class.php';
$pagination = new Pagination('posts');
$posts = $pagination->get_data($page_id);
?>
<div class="row cat_title">
<div class="col-sm-12">
<h1 class="text-right">
<span>أقسام » </span>
<?php if(!empty($_GET['page_title'])){ echo strtoupper(str_replace( '-', ' ',$_GET['page_title']));} else{
echo "# Dude just be nice and pick up a category from top menu";
} ?>
</h1>
<div class="hold_sub_cats">
<ul cless="child_cat">
<?php
$top_nav_cat = get_all_rec('*', 'categories', 'parent = 0', 'ID DESC', 4);
foreach ($top_nav_cat as $cat) {
if ($page_id == $cat['ID'] ) {
$down_nav_cat = get_all_rec("*", "sub_categories", "category_id = {$cat['ID']}", "id_sub DESC", 4);
foreach ($down_nav_cat as $down) {
?>
<li>
<?php
echo "<a href='categories.php?sub_cat=".$down['id_sub']."&page_title=".str_replace(' ', '-', $down['name_sub'])."'>";
echo $down['name_sub'];
echo "</a>"; ?>
</li>
<?php }
}
} ?>
</ul>
</div>
</div>
</div>
<div class="container">
<div id="post_ajax" class="row categories">
<?php
if (!empty($posts)) {
foreach ($posts as $post) {
?>
<div class="col-sm-12 col-md-4 col-lg-4 hovereffect">
<span class="img-responsive img_span" style="background-image: url('<?php echo empty($post->Image) ? 'admin/uploads/posts/user.jpg' : 'admin/uploads/posts/' . $post->Image;?>')" alt="">
</span>
<div class="overlay">
<div class="post_title_cat">
<h2>
<a id="<?php echo $post->Post_ID; ?>" href="posts.php?postid=<?php echo $post->Post_ID; ?>" class="checkActive">
<?php echo excerpt_len($post->Name); ?>
</a>
</h2>
</div>
<div class="">
<p>
<?php echo excerpt_len($post->Description,50, true); ?>
</p>
</div>
<div class="date">
<span class="">
<?php echo date("M Y", strtotime($post->Add_Date));?>
</span>
</div>
<div class="top_commented">
<span>
<?php echo $post->Rating . ' ' . "<i class='fas fa-star' style='font-size:11px !important;'></i>"; ?>
</span>
</div>
</div>
</div>
<?php
}
} else {
echo "There's No Posts To Show";
} ?>
</div>
</div>
<?php if (!empty($posts)) { ?>
<div class="cat_pagi row">
<ul class="col-sm-12 col-md-12">
<?php
$pages = $pagination->get_pagination_number($_GET['pageid']);
$curr = $pagination->current_page();
foreach ($pages as $page) {
$count = ceil($page['count'] / $pagination->limit);
for($i = 1; $i<$count; $i++){
?>
<li class="<?php echo $i == $curr ? "activePag" : ""; ?>">
<a href="categories.php?pageid=<?php echo isset($_GET['pageid']) ? $_GET['pageid'] : ""; ?>&page_title=<?php echo $_GET['page_title']; ?>&page=<? echo $i;?>">
<?php echo $i; ?>
</a>
</li>
<?php }
}
?>
</ul>
</div>
<?php } ?>
<?php $hook_up->inc_footer('main', '-') ?>