-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
68 lines (61 loc) · 2.41 KB
/
search.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
<?php require_once 'config/init.php';
$no_result = false;
if(isset($_GET['q']) && !empty($_GET['q'])){
$news = new News;
$all_news = $news->getSearchResult($_GET['q']);
}
$_meta = array(
'keywords' => 'Hompage, newsportal, news, nepali, samachar'
);
?>
<?php require_once 'inc/header.php'; ?>
<?php require_once 'inc/menu.php';?>
<div class="container">
<ul class="css-nav">
<li><a href="javascript:;">Search Result</a></li>
</ul>
<div class="row mt-5">
<div class="col-12">
<?php
if($no_result){
echo "<p class='alert alert-danger'>Category Not found.</p>";
} else {
if($all_news){
foreach($all_news as $news_list){
?>
<div class="row list-view">
<div class="col-md-4">
<?php
if ($news_list->image != null && file_exists(UPLOAD_DIR . '/news/' . $news_list->image)) {
?>
<img src="<?php echo UPLOAD_URL . '/news/' . $news_list->image ?>" style="width: 100%; height: auto;">
<?php
} else {
?>
<img src="<?php echo IMAGES_URL . '/logo.png' ?>" style="width: 100%; height: auto;">
<?php
}
?>
</div>
<div class="col-md-8">
<h4 class="text-justify">
<a href="news.php?id=<?php echo $news_list->id;?>">
<?php echo $news_list->title?>
</a>
</h4>
<p>
<?php echo $news_list->summary; ?>
</p>
</div>
</div>
<?php
}
} else {
echo "<p class='alert alert-danger'>No news in this category</a>";
}
}
?>
</div>
</div>
</div>
<?php require_once 'inc/footer.php';?>