-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecent.php
More file actions
262 lines (226 loc) · 9.76 KB
/
Copy pathrecent.php
File metadata and controls
262 lines (226 loc) · 9.76 KB
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS CDN -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/nav.css">
<link rel="stylesheet" href="css/home.css">
<link rel="stylesheet" href="css/threadlist.css">
<title><?php echo $catname;?> Threads</title>
<style>
/* Custom styling */
body {
background-color: #f7f9fc;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #212529;
}
.thread-card {
background-color: #ffffff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
transition: transform 0.3s ease, box-shadow 0.3s ease; /* Smooth transitions for hover effects */
}
.thread-card:hover {
transform: translateY(-3px); /* Slight lift effect */
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2); /* Deep shadow on hover */
}
h3 a {
text-decoration: none;
color: #007bff; /* Bootstrap primary color */
transition: color 0.3s ease; /* Transition for link color */
}
h3 a:hover {
color: #0056b3; /* Darker shade on hover */
}
.horizontal-separator {
height: 2px;
background-color: #e9ecef; /* Light grey color for separation */
margin: 10px 0;
}
.read-more {
background-color: transparent;
border: none;
color: #007bff;
cursor: pointer;
padding: 0;
font-size: 0.9rem;
transition: color 0.2s ease, transform 0.2s ease; /* Transition for button effects */
}
.read-more:hover {
color: #0056b3; /* Darker shade on hover */
transform: scale(1.05); /* Slightly increase size on hover */
}
@media (max-width: 768px) {
h3 a {
font-size: 1.2rem; /* Responsive font size */
}
}
@media (max-width: 576px) {
h3 a {
font-size: 1rem; /* Smaller font size for mobile */
}
.thread-card {
padding: 15px; /* Adjust padding for smaller screens */
}
}
/* Fade-in animation */
.fade-in {
opacity: 0;
animation: fadeIn 0.5s forwards; /* Animation for fade-in */
}
@keyframes fadeIn {
to {
opacity: 1;
}
}
.footer {
background-color: #0B60B0; /* Background color */
color: white; /* Text color */
padding: 40px 0; /* Padding */
position: relative; /* Positioning */
bottom: 0; /* Stick to bottom */
width: 100%; /* Full width */
}
.footer h5 {
font-size: 20px; /* Header font size */
margin-bottom: 20px; /* Margin below header */
}
.footer p {
line-height: 1.5; /* Line height for text */
}
.footer ul {
list-style-type: none; /* No bullet points */
padding: 0; /* Remove padding */
}
.footer ul li {
margin-bottom: 10px; /* Space between list items */
}
.footer ul li a {
color: white; /* Link color */
text-decoration: none; /* No underline */
transition: color 0.3s ease; /* Transition effect */
}
.footer ul li a:hover {
color: #ffe600; /* Highlight color on hover */
}
.footer .social-media {
display: flex; /* Flexbox layout */
gap: 10px; /* Space between icons */
}
.footer .social-media li {
display: inline; /* Inline layout */
}
.footer .social-media i {
margin-right: 5px; /* Space between icon and text */
}
@media (max-width: 768px){
.footer .row {
flex-direction: column; /* Stack on small screens */
align-items: center; /* Center items */
}
}
</style>
</head>
<body>
<!-- Navbar inclusion -->
<?php require 'partials/_navbar.php'?>
<!-- Threadlist section with Bootstrap container -->
<section class="threadlist-container-section container">
<div class="row">
<div class="col-12">
<!-- PHP Thread loop -->
<?php
$sql = "SELECT * FROM `threads` ORDER BY timestamp DESC";
$result = mysqli_query($conn, $sql);
$totalRows = mysqli_num_rows($result);
if($totalRows > 0){
$count = 1;
while($row = mysqli_fetch_assoc($result)){
echo '<div class="thread-card fade-in">'; // Added fade-in class
echo '<h3><a href="thread.php?tid='.$row['thread_id'].'">'.$row['thread_title'].'</a></h3>';
$desc_string = $row['thread_desc'];
$string_length = strlen($desc_string);
$right_trimmed_desc = substr($desc_string, 0, 169);
$left_trimmed_desc = substr($desc_string, 169);
if($string_length > 169){
// Show only starting text by default
echo '<p><span id="desc_start_'.$count.'">'.$right_trimmed_desc.'</span>
<span id="desc_more_'.$count.'" style="display:none;">'.$left_trimmed_desc.'</span>
<span id="dots_'.$count.'">...</span>
<button onclick="readMore('.$count.')" class="read-more" id="read-more-btn_'.$count.'">(Read more)</button></p>';
} else {
echo '<p>'.$row['thread_desc'].'</p>';
}
echo '<div class="horizontal-separator"></div></div>';
$count++;
}
} else {
echo '<div><h1>No Threads Yet, Be the first to Start a Conversation</h1></div>';
}
?>
</div>
</div>
</section>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-md-4">
<h5>About Threadly</h5>
<p>Threadly is a vibrant community where passionate individuals explore, learn, and share knowledge on diverse topics. Join us to foster connections and build a strong community.</p>
</div>
<div class="col-md-4">
<h5>Quick Links</h5>
<ul>
<li><a href="/FP/index.php">Home</a></li>
<li><a href="/FP/about.php">About Us</a></li>
<li><a href="/FP/categories.php">Categories</a></li>
<li><a href="/FP/trending.php">Trending</a></li>
<li><a href="/FP/recent.php">Recent</a></li>
</ul>
</div>
<div class="col-md-4">
<h5>Connect with Us</h5>
<ul class="social-media">
<li><a href="https://www.facebook.com" target="_blank"><i class="fab fa-facebook-f"></i> Facebook</a></li>
<li><a href="https://www.twitter.com" target="_blank"><i class="fab fa-twitter"></i> Twitter</a></li>
<li><a href="https://www.instagram.com" target="_blank"><i class="fab fa-instagram"></i> Instagram</a></li>
<li><a href="https://www.linkedin.com" target="_blank"><i class="fab fa-linkedin-in"></i> LinkedIn</a></li>
</ul>
</div>
</div>
<div class="text-center">
<p>© 2024 Threadly. All rights reserved.</p>
</div>
</div>
</footer>
<!-- Read More / Read Less Script -->
<script>
function readMore(count) {
var dots = document.getElementById("dots_" + count);
var moreText = document.getElementById("desc_more_" + count);
var btnText = document.getElementById("read-more-btn_" + count);
var descStart = document.getElementById("desc_start_" + count);
if (dots.style.display === "none") {
dots.style.display = "inline";
btnText.innerHTML = "(Read more)";
moreText.style.display = "none";
descStart.style.display = "inline"; // Display the starting text
} else {
dots.style.display = "none";
btnText.innerHTML = "(Read less)";
moreText.style.display = "inline";
// Do not hide the starting text when "Read more" is clicked
}
}
</script>
<!-- Bootstrap JS and dependencies -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.1/dist/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
</body>
</html>