-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews.php
173 lines (159 loc) · 7.39 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
<?php require_once 'config/init.php';
$no_news = false;
if(isset($_GET['id']) && !empty($_GET['id'])){
$news_id = (int)$_GET['id'];
if($news_id <= 0){
$no_news = true;
}
$news = new News;
$news_info = $news->getRowById($news_id);
if(!$news_info){
$no_news = true;
} else {
$_meta = array(
'keywords' => $news_info[0]->title,
'description' => $news_info[0]->summary,
'image' => UPLOAD_URL.'news/'.$news_info[0]->image
);
}
}
?>
<?php require_once 'inc/header.php'; ?>
<?php require_once 'inc/menu.php';?>
<div class="container">
<div class="row mt-5">
<div class="col-12">
<?php
if($no_news){
echo "<p class='alert alert-danger'>Category Not found.</p>";
} else {
?>
<h1 class="text-center">
<strong>
<?php echo $news_info[0]->title;?>
</strong>
</h1>
<br>
<?php
if($news_info[0]->image != null && file_exists(UPLOAD_DIR.'/news/'.$news_info[0]->image)){
?>
<div class="row">
<div class="col-12 text-center">
<img src="<?php echo UPLOAD_URL.'news/'.$news_info[0]->image;?>" alt="<?php echo $news_info[0]->title;?>" class="img img-thumbnail img-fluid">
</div>
</div>
<?php
}
?>
<div class="row mt-5">
<div class="col-sm-12 col-md-6">
<p>
<small>
<i class="fa fa-calendar"></i>
<em>
<?php echo date('j, F Y',strtotime($news_info[0]->news_date))?>
</em>
</small>,
<small>
<i class="fa fa-map-marker"></i>
<em>
<?php echo $news_info[0]->location?>
</em>
</small>
</p>
</div>
<div class="col-sm-12 col-md-6">
<div class="addthis_inline_share_toolbox"></div>
</div>
</div>
<div class="row mt-5">
<div class="col-12">
<div class="text-justify">
<?php
echo html_entity_decode($news_info[0]->description);
// echo $news_info[0]->description;
?>
</div>
</div>
<div class="col-12">
<small>
<em>
Source: <?php echo $news_info[0]->source;?>
</em>,
<em>
Reporter:
<?php
$user = new User;
$user_info = $user->getRowById($news_info[0]->reporter_id);
echo $user_info[0]->full_name;
?>
</em>
</small>
</div>
</div>
<hr>
<div class="row">
<div class="col-12">
<ul class="css-nav">
<li><a href="javascript:;">Comments</a></li>
</ul>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="fb-comments"
data-href="<?php echo getCurrentUrl();?>" data-width="100%" data-numposts="10"></div>
</div>
</div>
<hr>
<div class="row">
<div class="col-12">
<ul class="css-nav">
<li><a href="javascript:;">Related News</a></li>
</ul>
</div>
</div>
<div class="row">
<?php
$related_news = $news->getRelatedNews($news_info[0]->cat_id, $news_info[0]->id);
if($related_news){
foreach($related_news as $key => $news_related){
?>
<div class="col-sm-12 col-md-3 mt-5">
<div class="row">
<div class="col-12">
<a href="news.php?id=<?php echo $news_related->id?>">
<?php
if($news_related->image != null && file_exists(UPLOAD_DIR.'/news/'.$news_related->image)){
?>
<img src="<?php echo UPLOAD_URL.'news/'.$news_related->image;?>" alt="<?php echo $news_related->title;?>" class="img img-thumbnail img-fluid">
<?php
} else {
?>
<img src="<?php echo IMAGES_URL.'/logo.png';?>" alt="<?php echo $news_related->title;?>" class="img img-thumbnail img-fluid">
<?php
}
?>
</a>
</div>
<div class="col-12">
<a href="news.php?id=<?php echo $news_related->id;?>">
<h4>
<?php echo $news_related->title;?>
</h4>
</a>
</div>
</div>
</div>
<?php
}
}
?>
</div>
<?php
}
?>
</div>
</div>
</div>
<?php require_once 'inc/footer.php';?>