134 lines
6.9 KiB
PHP
134 lines
6.9 KiB
PHP
<?php
|
|
require_once __DIR__ . '/db/config.php';
|
|
|
|
$recipes = [];
|
|
$error_message = null;
|
|
|
|
try {
|
|
$pdo = db();
|
|
$stmt = $pdo->query('SELECT * FROM recipes ORDER BY created_at DESC');
|
|
$recipes = $stmt->fetchAll();
|
|
} catch (PDOException $e) {
|
|
error_log('Database error: ' . $e->getMessage());
|
|
$error_message = 'We are currently experiencing technical difficulties. Please try again later.';
|
|
}
|
|
|
|
$project_image_url = $_SERVER['PROJECT_IMAGE_URL'] ?? 'https://via.placeholder.com/1200x630.png?text=rfresh';
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<title>rfresh - Fresh Recipes Delivered</title>
|
|
<meta name="description" content="Discover delicious, chef-designed recipes with fresh ingredients delivered to your door. Cooking made easy and fun.">
|
|
<meta name="keywords" content="meal kit, recipe box, food delivery, cooking, fresh ingredients, subscription service, dinner, healthy eating, convenient meals, weekly recipes, food subscription, Built with Flatlogic Generator">
|
|
|
|
<meta property="og:type" content="website">
|
|
<meta property="og:title" content="rfresh - Fresh Recipes Delivered">
|
|
<meta property="og:description" content="Discover delicious, chef-designed recipes with fresh ingredients delivered to your door. Cooking made easy and fun.">
|
|
<meta property="og:image" content="<?php echo htmlspecialchars($project_image_url); ?>">
|
|
|
|
<meta name="twitter:card" content="summary_large_image">
|
|
<meta name="twitter:title" content="rfresh - Fresh Recipes Delivered">
|
|
<meta name="twitter:description" content="Discover delicious, chef-designed recipes with fresh ingredients delivered to your door. Cooking made easy and fun.">
|
|
<meta name="twitter:image" content="<?php echo htmlspecialchars($project_image_url); ?>">
|
|
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
|
|
|
<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=Georgia&family=Helvetica+Neue&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 sticky-top">
|
|
<div class="container">
|
|
<a class="navbar-brand" href="/">rfresh</a>
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto align-items-center">
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="#recipes">Our Menus</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/pricing.php">Pricing</a>
|
|
</li>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="/login.php">Log In</a>
|
|
</li>
|
|
<li class="nav-item ms-lg-3">
|
|
<a class="btn btn-primary" href="/register.php">Sign Up</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
|
|
<main>
|
|
<section class="hero-section text-center">
|
|
<div class="container">
|
|
<h1 class="display-4">Eat well, live fresh.</h1>
|
|
<p class="lead">Chef-crafted recipes and fresh, pre-portioned ingredients delivered to your door. Say goodbye to meal planning and hello to delicious, home-cooked dinners.</p>
|
|
<a href="#recipes" class="btn btn-primary btn-lg">Explore This Week's Menu</a>
|
|
</div>
|
|
</section>
|
|
|
|
<div class="album py-5" id="recipes">
|
|
<div class="container">
|
|
<div class="page-title">
|
|
<h2>This Week's Recipes</h2>
|
|
<p class="lead text-muted">Choose from a variety of delicious meals to fit your lifestyle.</p>
|
|
</div>
|
|
|
|
<?php if ($error_message): ?>
|
|
<div class="alert alert-danger" role="alert">
|
|
<?php echo htmlspecialchars($error_message); ?>
|
|
</div>
|
|
<?php elseif (empty($recipes)): ?>
|
|
<div class="text-center">
|
|
<p>No recipes available at the moment. Please check back later!</p>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="row row-cols-1 row-cols-sm-2 row-cols-lg-3 g-4">
|
|
<?php foreach ($recipes as $recipe): ?>
|
|
<div class="col">
|
|
<a href="recipe.php?id=<?php echo $recipe['id']; ?>" class="text-decoration-none">
|
|
<div class="card recipe-card h-100">
|
|
<img src="<?php echo htmlspecialchars($recipe['image_url']); ?>" class="card-img-top" alt="<?php echo htmlspecialchars($recipe['title']); ?>">
|
|
<div class="card-body d-flex flex-column">
|
|
<h3 class="card-title"><?php echo htmlspecialchars($recipe['title']); ?></h3>
|
|
<p class="card-text flex-grow-1"><?php echo htmlspecialchars($recipe['description']); ?></p>
|
|
<div class="d-flex justify-content-between align-items-center mt-3">
|
|
<span class="badge bg-primary"><?php echo htmlspecialchars($recipe['difficulty']); ?></span>
|
|
<small class="text-muted"><?php echo htmlspecialchars($recipe['prep_time_minutes']); ?> min</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</a>
|
|
</div>
|
|
<?php endforeach; ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="footer">
|
|
<div class="container text-center">
|
|
<p class="mb-1">© <?php echo date('Y'); ?> rfresh. All rights reserved.</p>
|
|
<p class="mb-0">Built with <a href="https://flatlogic.com" target="_blank" rel="noopener noreferrer">Flatlogic</a>.</p>
|
|
</div>
|
|
</footer>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
|
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|