From 8d321c93b449dabd22b03da9bcc49804293fc5ea Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 13 Jan 2026 13:13:25 +0000 Subject: [PATCH] v1 --- assets/css/custom.css | 24 ++++++ db/setup.php | 50 ++++++++++++ footer.php | 7 ++ header.php | 18 +++++ index.php | 171 ++++++------------------------------------ post.php | 34 +++++++++ 6 files changed, 157 insertions(+), 147 deletions(-) create mode 100644 assets/css/custom.css create mode 100644 db/setup.php create mode 100644 footer.php create mode 100644 header.php create mode 100644 post.php diff --git a/assets/css/custom.css b/assets/css/custom.css new file mode 100644 index 0000000..38bc618 --- /dev/null +++ b/assets/css/custom.css @@ -0,0 +1,24 @@ +body { + font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; + background-color: #f8f9fa; +} + +.navbar-brand { + font-family: Georgia, 'Times New Roman', Times, serif; + font-weight: bold; +} + +.post-card { + background-color: #ffffff; + border-radius: 8px; + box-shadow: 0 4px 6px rgba(0,0,0,0.1); + transition: transform 0.2s; +} + +.post-card:hover { + transform: translateY(-5px); +} + +.post-title { + font-family: Georgia, 'Times New Roman', Times, serif; +} diff --git a/db/setup.php b/db/setup.php new file mode 100644 index 0000000..26eb24c --- /dev/null +++ b/db/setup.php @@ -0,0 +1,50 @@ +exec($sql); + + // Check if posts table is empty + $stmt = $pdo->query("SELECT COUNT(*) FROM posts"); + $postCount = $stmt->fetchColumn(); + + if ($postCount == 0) { + $posts = [ + [ + 'title' => 'The Future of Web Development', + 'content' => 'The web is constantly evolving. In this post, we explore the latest trends in web development, from serverless architectures to the rise of AI-powered tools. Stay ahead of the curve and learn what to expect in the coming years.', + 'author' => 'Jane Doe' + ], + [ + 'title' => 'A Guide to Mindful Coding', + 'content' => 'Coding can be stressful. This guide offers practical tips for staying focused, managing complexity, and writing better code through mindfulness. Learn how to bring a sense of calm and clarity to your development process.', + 'author' => 'John Smith' + ], + [ + 'title' => 'Mastering CSS Grid', + 'content' => 'CSS Grid is a powerful tool for creating complex layouts with ease. This tutorial walks you through the fundamentals of Grid, with practical examples and pro tips to help you master this essential CSS feature.', + 'author' => 'Emily White' + ] + ]; + + $stmt = $pdo->prepare("INSERT INTO posts (title, content, author) VALUES (?, ?, ?)"); + foreach ($posts as $post) { + $stmt->execute([$post['title'], $post['content'], $post['author']]); + } + } +} + +setup_database(); +?> \ No newline at end of file diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..b380133 --- /dev/null +++ b/footer.php @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/header.php b/header.php new file mode 100644 index 0000000..2aa4b34 --- /dev/null +++ b/header.php @@ -0,0 +1,18 @@ + + + + + + <?php echo htmlspecialchars($page_title ?? 'Clean Blog'); ?> + + + + + + + +
\ No newline at end of file diff --git a/index.php b/index.php index 7205f3d..e4ae345 100644 --- a/index.php +++ b/index.php @@ -1,150 +1,27 @@ query("SELECT * FROM posts ORDER BY created_at DESC"); +$posts = $stmt->fetchAll(); ?> - - - - - - New Style - - - - - - - - - - - - - - - - - - - - - -
-
-

Analyzing your requirements and generating your website…

-
- Loading… -
-

AI is collecting your requirements and applying the first changes.

-

This page will update automatically as the plan is implemented.

-

Runtime: PHP — UTC

-
-
-
- Page updated: (UTC) -
- - + +
+ +
+
+
+
+

...

+ Read More +
+
+
+ +
+ + \ No newline at end of file diff --git a/post.php b/post.php new file mode 100644 index 0000000..30f67b5 --- /dev/null +++ b/post.php @@ -0,0 +1,34 @@ +prepare("SELECT * FROM posts WHERE id = ?"); +$stmt->execute([$_GET['id'] ?? 0]); +$post = $stmt->fetch(); + +if (!$post) { + header("Location: index.php"); + exit; +} + +$page_title = htmlspecialchars($post['title']); +$page_description = htmlspecialchars(substr($post['content'], 0, 160)); + +include 'header.php'; +?> + +
+
+
+
+

+

By on

+

+
+
+ Back to Home +
+
+ + + \ No newline at end of file