PNG IHDR x sBIT|d pHYs + tEXtSoftware www.inkscape.org< ,tEXtComment
<?php
session_start();
require 'db.php';
// Fetch all published posts, newest first
try {
$stmt = $pdo->query("SELECT * FROM posts WHERE status = 'published' ORDER BY created_at DESC");
$posts = $stmt->fetchAll();
} catch (Exception $e) {
$posts = [];
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Latest News - Global Relief Bridge</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<style>
/* --- COPYING YOUR CORE STYLES --- */
:root {
--primary-green: #266fc9;
--dark-green: #070767;
--primary-purple: #665de5;
--action-blue: #007BFF;
--text-dark: #333;
--bg-light: #f4f7f6;
}
* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-light); color: var(--text-dark); }
a { text-decoration: none; color: inherit; transition: 0.3s; }
img { max-width: 100%; display: block; border-radius: 15px; }
/* --- UTILITIES --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.section { padding: 60px 0; }
.text-center { text-align: center; }
.section-title { font-size: 2.2rem; color: var(--dark-green); margin-bottom: 15px; font-weight: 800; }
/* Grid Layouts */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
/* Blog Card Styles */
.card {
background: white; border-radius: 20px; overflow: hidden;
box-shadow: 0 5px 20px rgba(0,0,0,0.05); transition: transform 0.3s; height: 100%; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); }
.card img { border-radius: 0; height: 220px; width: 100%; object-fit: cover; }
.card-body { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; }
.card h3 { color: var(--dark-green); margin-bottom: 10px; font-size: 1.3rem; line-height: 1.4; }
.blog-meta { font-size: 0.85rem; color: #888; margin-bottom: 10px; text-transform: uppercase; font-weight: 600; }
.card-excerpt { color: #666; font-size: 0.95rem; margin-bottom: 20px; line-height: 1.6; flex-grow: 1; }
.btn-read {
display: inline-block; padding: 10px 20px; border-radius: 50px;
background: var(--primary-green); color: white; font-weight: bold;
text-align: center; margin-top: auto; align-self: flex-start;
}
.btn-read:hover { background: var(--dark-green); }
/* Hero Mini */
.page-header {
background: linear-gradient(to right, var(--dark-green), var(--primary-green));
color: white; padding: 60px 0; text-align: center; margin-bottom: 40px;
border-bottom-left-radius: 30px; border-bottom-right-radius: 30px;
}
/* Responsive */
@media (max-width: 900px) {
.grid-3 { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<?php include 'header.php'; ?>
<div class="page-header">
<div class="container">
<h1 style="font-size: 2.5rem; font-weight: 900;">Latest News & Updates</h1>
<p>Stories of impact from around the world.</p>
</div>
</div>
<section class="section container">
<?php if(empty($posts)): ?>
<div class="text-center" style="padding: 50px;">
<h3>No news yet.</h3>
<p>Check back soon for updates on our campaigns.</p>
</div>
<?php else: ?>
<div class="grid-3">
<?php foreach ($posts as $post): ?>
<div class="card">
<a href="post.php?id=<?php echo $post['post_id']; ?>">
<?php if($post['featured_image']): ?>
<img src="<?php echo htmlspecialchars($post['featured_image']); ?>" alt="Blog Image">
<?php else: ?>
<img src="https://via.placeholder.com/600x400/eee/ccc?text=Global+Relief" alt="Placeholder">
<?php endif; ?>
</a>
<div class="card-body">
<div class="blog-meta">
<i class="far fa-calendar-alt"></i> <?php echo date('M d, Y', strtotime($post['created_at'])); ?>
</div>
<a href="post.php?id=<?php echo $post['post_id']; ?>">
<h3><?php echo htmlspecialchars($post['title']); ?></h3>
</a>
<p class="card-excerpt">
<?php
// Limit excerpt to 100 characters
echo substr(htmlspecialchars($post['excerpt']), 0, 100) . '...';
?>
</p>
<a href="post.php?id=<?php echo $post['post_id']; ?>" class="btn-read">
Read More <i class="fas fa-arrow-right"></i>
</a>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</section>
<?php include 'footer.php'; ?>
</body>
</html>
b IDATxytVսϓ22 A@IR:hCiZ[v*E:WũZA ^dQeQ @ !jZ'>gsV仿$|?g)&x-E