-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcategory.php
executable file
·110 lines (86 loc) · 2.36 KB
/
category.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
<!Doctype html>
<?php
include("config/conf.inc");
?>
<html>
<head>
<link rel="stylesheet" href="css/bootstrap.css" type="text/css" />
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="row">
<h3>Recent News</h3>
<?php
$select=mysql_query("SELECT * FROM news order by pub_date desc limit 5");
while($record=mysql_fetch_array($select)){
?>
<a href='details.php?id=<?php echo $record[id]; ?>'>
<?php
echo $record['title'];
?>
</a><br/>
<?php
}
?>
<h3>Categories</h3>
<?php
$select=mysql_query("SELECT distinct category FROM news");
while($record=mysql_fetch_array($select)){
?>
<a href='category.php?cat=<?php echo $record[category]; ?>'>
<?php
echo $record['category'];
?>
</a><br/>
<?php
}
?>
</div>
</div>
<div class="col-md-8">
<?php
$category=$_GET['cat'];
?>
<div id="postlist">
<div class="panel">
<div class="panel-heading">
<div class="text-center">
<div class="row">
<div class="col-sm-9">
<h3 class="pull-left">News in <?php echo $category; ?>
</h3>
</div>
</div>
</div>
</div>
<?php
$select=mysql_query("SELECT * FROM news where category='$category'");
while($row=mysql_fetch_array($select)){
?>
<div class="panel-body">
<?php
$txt=$row['title'];
echo "<a href='details.php?id=$row[id]'>" .$txt."</a>";
?>
</div>
<div class="panel-footer">
<?php
$tags=$row['tags'];
$tagsarr=explode(",", $tags);
foreach ($tagsarr as $key=>$value) {
echo " <span class='label label-default'>$value</span>";
}
?>
</div>
</div>
<?php
}
?>
</div>
</div>
</div>
</div>
</body>
</html>