-
Notifications
You must be signed in to change notification settings - Fork 0
/
newspage.php
85 lines (78 loc) · 2.83 KB
/
newspage.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
<!DOCTYPE html>
<html>
<head>
<title>News page</title>
<link href="https://fonts.googleapis.com/css?family=Righteous" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="../myproject/css/newspagestyle.css">
<link href="https://fonts.googleapis.com/css?family=Oswald" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Anton|Asap" rel="stylesheet">
<link rel = "stylesheet" href = "https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel = "stylesheet" href = "\myproject\css\materialize.min.css">
<script type = "text/javascript"src = "https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src = "\myproject\js\materialize.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#search").on("keyup", function() {
var value = $(this).val().toLowerCase();
$(".news").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1)
});
});
});
</script>
</head>
<body>
<center>
<h1 class="tp">TECH NEWS HUB</h1>
</center>
<ul id="mode">
<li id="mode1">
<span class="mode2">Dark</span>
<span class="mode2">Light</span>
</li>
</ul>
<div id="menu-bar">
<ul>
<li> <a href="">Home</a></li>
<li> <a href="contact.php">Contact</a></li>
<li> <a href="index.php">Logout</a></li>
</ul>
<nav>
<div class="nav-wrapper">
<form>
<div class="input-field">
<input id="search" type="search" placeholder="Search" required>
<label class="label-icon" for="search"><i class="material-icons">search</i></label>
<i class="material-icons">close</i>
</div>
</form>
</div>
</nav>
</div>
<?php
$db= mysqli_connect("localhost","root","","photos");
$sql="SELECT * FROM images ORDER BY id DESC";
$result=mysqli_query($db,$sql);
while($row=mysqli_fetch_array($result)){
echo"<div>";
echo"<div class='news'>";
echo "<h1 class='newshead'>".$row['texthead']."</h1>";
echo "<img class='newsimg' src='images/".$row['image']."'>";
echo "<p class='newsinfo'>".$row['text']."</p>";
echo"</div>";
echo"</div>";
}
?>
<script src="../myproject/js/jquery-3.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#mode').click(function(){
$('#mode').toggleClass('active')
$('body').toggleClass('dark')
$('tp').toggleClass('dark')
})
})
</script>
</body>
</html>