Files
FARM/index.php
T
2026-06-25 21:29:21 +00:00

108 lines
3.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
$dataFile = __DIR__ . '/data/plants.json';
$months = [
1=>"January",2=>"February",3=>"March",4=>"April",
5=>"May",6=>"June",7=>"July",8=>"August",
9=>"September",10=>"October",11=>"November",12=>"December"
];
$monthEmoji = [
1=>"❄️",2=>"❄️",3=>"🌱",4=>"🌸",5=>"🌿",6=>"☀️",
7=>"☀️",8=>"🌻",9=>"🍂",10=>"🍂",11=>"🌧️",12=>"❄️"
];
$plantCounts = array_fill(1, 12, 0);
$plantsData = [];
if (file_exists($dataFile)) {
$json = json_decode(file_get_contents($dataFile), true);
if ($json && isset($json['plants'])) {
$plantsData = $json['plants'];
foreach ($plantsData as $plant) {
foreach (array_keys($plant['months'] ?? []) as $m) {
$plantCounts[(int)$m]++;
}
}
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zone 8b Planting Calendar</title>
<link rel="stylesheet" href="assets/style.css">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
</head>
<body>
<header class="site-header">
<div class="header-inner">
<div class="logo">
<span class="logo-icon">🌱</span>
<div>
<h1>Zone 8b Planting Calendar</h1>
<p class="logo-sub">Your year-round garden guide</p>
</div>
</div>
<nav class="top-nav">
<a href="index.php" class="nav-link active">Calendar</a>
<a href="plants.php" class="nav-link">All Plants</a>
</nav>
</div>
</header>
<main class="content">
<section class="hero">
<h2>What to Plant Each Month</h2>
<p>Click any month to see what to plant in <strong>USDA Zone 8b</strong>.</p>
</section>
<?php if (empty($plantsData)): ?>
<div class="notice warning">
⚠️ <strong>No plant data found.</strong>
Run <code>python3 scraper.py</code> first, then reload this page.
</div>
<?php endif; ?>
<div class="month-grid">
<?php foreach ($months as $num => $name): ?>
<a href="month.php?m=<?= $num ?>" class="month-card">
<div class="month-emoji"><?= $monthEmoji[$num] ?></div>
<div class="month-name"><?= $name ?></div>
<div class="month-count">
<?php if ($plantCounts[$num] > 0): ?>
<span class="count-badge"><?= $plantCounts[$num] ?> plants</span>
<?php else: ?>
<span class="count-badge empty">No data yet</span>
<?php endif; ?>
</div>
</a>
<?php endforeach; ?>
</div>
<section class="info-strip">
<div class="info-item">
<span class="info-icon">🌡️</span>
<div><strong>Zone 8b</strong><small>Min temp 1520°F</small></div>
</div>
<div class="info-item">
<span class="info-icon">🗓️</span>
<div><strong>Last Frost</strong><small>~Mid March</small></div>
</div>
<div class="info-item">
<span class="info-icon">🍂</span>
<div><strong>First Frost</strong><small>~Late November</small></div>
</div>
<div class="info-item">
<span class="info-icon">☀️</span>
<div><strong>Growing Season</strong><small>~251 days</small></div>
</div>
</section>
</main>
<footer class="site-footer">
<p>Zone 8b Garden Planting Guide &mdash; Data sourced from
<a href="https://gardenate.com" target="_blank">Gardenate.com</a></p>
</footer>
</body>
</html>