v1
This commit is contained in:
parent
30b69ff5dd
commit
44a47c5d24
78
assets/css/custom.css
Normal file
78
assets/css/custom.css
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
Palette:
|
||||||
|
- Primary: #3B82F6 (Blue)
|
||||||
|
- Secondary: #10B981 (Green)
|
||||||
|
- Background: #F9FAFB (Light Gray)
|
||||||
|
- Surface: #FFFFFF (White)
|
||||||
|
- Text: #1F2937 (Dark Gray)
|
||||||
|
- Subtle Text: #6B7280 (Lighter Gray)
|
||||||
|
*/
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--primary-color: #3B82F6;
|
||||||
|
--secondary-color: #10B981;
|
||||||
|
--background-color: #F9FAFB;
|
||||||
|
--surface-color: #FFFFFF;
|
||||||
|
--text-color: #1F2937;
|
||||||
|
--subtle-text-color: #6B7280;
|
||||||
|
--heading-font: Georgia, 'Times New Roman', Times, serif;
|
||||||
|
--body-font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: var(--background-color);
|
||||||
|
color: var(--text-color);
|
||||||
|
font-family: var(--body-font);
|
||||||
|
}
|
||||||
|
|
||||||
|
h1, h2, h3, h4, h5, h6 {
|
||||||
|
font-family: var(--heading-font);
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar-brand {
|
||||||
|
font-family: var(--heading-font);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-card {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
border: 1px solid #E5E7EB;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
|
||||||
|
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-card:hover {
|
||||||
|
transform: translateY(-4px);
|
||||||
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-card img {
|
||||||
|
border-top-left-radius: 8px;
|
||||||
|
border-top-right-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary {
|
||||||
|
background-color: var(--primary-color);
|
||||||
|
border-color: var(--primary-color);
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-primary:hover {
|
||||||
|
background-color: #2563EB;
|
||||||
|
border-color: #2563EB;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content {
|
||||||
|
line-height: 1.8;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-content img {
|
||||||
|
max-width: 100%;
|
||||||
|
height: auto;
|
||||||
|
border-radius: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
background-color: var(--surface-color);
|
||||||
|
}
|
||||||
0
assets/js/main.js
Normal file
0
assets/js/main.js
Normal file
196
index.php
196
index.php
@ -1,131 +1,81 @@
|
|||||||
<?php
|
<?php
|
||||||
declare(strict_types=1);
|
require_once 'db/config.php';
|
||||||
@ini_set('display_errors', '1');
|
$posts = [];
|
||||||
@error_reporting(E_ALL);
|
try {
|
||||||
@date_default_timezone_set('UTC');
|
$pdo = db();
|
||||||
|
$stmt = $pdo->query("SELECT * FROM posts ORDER BY created_at DESC");
|
||||||
$phpVersion = PHP_VERSION;
|
$posts = $stmt->fetchAll();
|
||||||
$now = date('Y-m-d H:i:s');
|
} catch (PDOException $e) {
|
||||||
|
// For a real app, you'd log this error and show a user-friendly message.
|
||||||
|
// For this demo, we'll just show the error.
|
||||||
|
error_log("DB Error: " . $e->getMessage());
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>New Style</title>
|
<title>My Awesome Blog</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<meta name="description" content="A clean blog to publish updates and articles.">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
<!-- Open Graph -->
|
||||||
<style>
|
<meta property="og:title" content="My Awesome Blog">
|
||||||
:root {
|
<meta property="og:description" content="A clean blog to publish updates and articles.">
|
||||||
--bg-color-start: #6a11cb;
|
<meta property="og:type" content="website">
|
||||||
--bg-color-end: #2575fc;
|
<meta property="og:url" content="http://<?php echo $_SERVER['HTTP_HOST']; ?>">
|
||||||
--text-color: #ffffff;
|
<meta property="og:image" content="https://picsum.photos/seed/hero-1/1200/600">
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
}
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
body {
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
margin: 0;
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
font-family: 'Inter', sans-serif;
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
|
||||||
<div class="card">
|
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<div class="container">
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<a class="navbar-brand" href="/">My Awesome Blog</a>
|
||||||
<span class="sr-only">Loading…</span>
|
</div>
|
||||||
</div>
|
</nav>
|
||||||
<p class="hint">Flatlogic AI is collecting your requirements and applying the first changes.</p>
|
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<main class="container my-5">
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<div class="text-center mb-5">
|
||||||
</div>
|
<h1 class="display-4">Welcome to the Blog</h1>
|
||||||
</main>
|
<p class="lead text-muted">The latest articles and updates, just for you.</p>
|
||||||
<footer>
|
</div>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
|
||||||
</footer>
|
<?php if (empty($posts)): ?>
|
||||||
|
<div class="text-center">
|
||||||
|
<p>No posts found. Run the setup script to seed the database.</p>
|
||||||
|
<code>php db/setup.php</code>
|
||||||
|
</div>
|
||||||
|
<?php else: ?>
|
||||||
|
<div class="row g-4">
|
||||||
|
<?php foreach ($posts as $post): ?>
|
||||||
|
<div class="col-md-6 col-lg-4 d-flex align-items-stretch">
|
||||||
|
<div class="card post-card w-100">
|
||||||
|
<img src="<?php echo htmlspecialchars($post['image_url']); ?>" class="card-img-top" alt="Abstract placeholder image for the blog post titled '<?php echo htmlspecialchars($post['title']); ?>'">
|
||||||
|
<div class="card-body d-flex flex-column">
|
||||||
|
<h5 class="card-title"><?php echo htmlspecialchars($post['title']); ?></h5>
|
||||||
|
<p class="card-text text-muted flex-grow-1"><?php echo htmlspecialchars($post['excerpt']); ?></p>
|
||||||
|
<a href="post.php?id=<?php echo $post['id']; ?>" class="btn btn-primary mt-auto align-self-start">Read More</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="footer mt-auto py-3 bg-white border-top">
|
||||||
|
<div class="container text-center">
|
||||||
|
<span class="text-muted">© <?php echo date("Y"); ?> My Awesome Blog. All Rights Reserved.</span>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
85
post.php
Normal file
85
post.php
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
require_once 'db/config.php';
|
||||||
|
|
||||||
|
$post_id = $_GET['id'] ?? null;
|
||||||
|
|
||||||
|
if (!$post_id || !filter_var($post_id, FILTER_VALIDATE_INT)) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$post = null;
|
||||||
|
try {
|
||||||
|
$pdo = db();
|
||||||
|
$stmt = $pdo->prepare("SELECT * FROM posts WHERE id = ?");
|
||||||
|
$stmt->execute([$post_id]);
|
||||||
|
$post = $stmt->fetch();
|
||||||
|
} catch (PDOException $e) {
|
||||||
|
error_log("DB Error: " . $e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no post is found, redirect to the homepage
|
||||||
|
if (!$post) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title><?php echo htmlspecialchars($post['title']); ?> - My Awesome Blog</title>
|
||||||
|
<meta name="description" content="<?php echo htmlspecialchars($post['excerpt']); ?>">
|
||||||
|
|
||||||
|
<!-- Open Graph -->
|
||||||
|
<meta property="og:title" content="<?php echo htmlspecialchars($post['title']); ?>">
|
||||||
|
<meta property="og:description" content="<?php echo htmlspecialchars($post['excerpt']); ?>">
|
||||||
|
<meta property="og:type" content="article">
|
||||||
|
<meta property="og:url" content="http://<?php echo $_SERVER['HTTP_HOST']; ?>/post.php?id=<?php echo $post['id']; ?>">
|
||||||
|
<meta property="og:image" content="<?php echo htmlspecialchars($post['image_url']); ?>">
|
||||||
|
|
||||||
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||||
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-light bg-white shadow-sm">
|
||||||
|
<div class="container">
|
||||||
|
<a class="navbar-brand" href="/">My Awesome Blog</a>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<main class="container my-5">
|
||||||
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-lg-8">
|
||||||
|
<article>
|
||||||
|
<header class="mb-4">
|
||||||
|
<h1 class="fw-bolder mb-1 display-5"><?php echo htmlspecialchars($post['title']); ?></h1>
|
||||||
|
<div class="text-muted fst-italic mb-2">Posted on <?php echo date('F j, Y', strtotime($post['created_at'])); ?></div>
|
||||||
|
</header>
|
||||||
|
<figure class="mb-4">
|
||||||
|
<img class="img-fluid rounded" src="<?php echo htmlspecialchars($post['image_url']); ?>" alt="Hero image for the blog post titled '<?php echo htmlspecialchars($post['title']); ?>'">
|
||||||
|
</figure>
|
||||||
|
<section class="mb-5 post-content fs-5">
|
||||||
|
<?php echo nl2br(htmlspecialchars($post['content'])); ?>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
<a href="/" class="btn btn-outline-primary">← Back to all posts</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer class="footer mt-auto py-3 bg-white border-top">
|
||||||
|
<div class="container text-center">
|
||||||
|
<span class="text-muted">© <?php echo date("Y"); ?> My Awesome Blog. All Rights Reserved.</span>
|
||||||
|
</div>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Loading…
x
Reference in New Issue
Block a user