JezK
Edit File: header.php
<?php // header.php if (!isset($pdo)) { require_once __DIR__ . '/db.php'; } // Fetch all distinct categories and products for the mega menu try { $stmt = $pdo->query("SELECT DISTINCT category FROM products"); $dbCategories = $stmt->fetchAll(PDO::FETCH_COLUMN); } catch (Exception $e) { $dbCategories = []; } // Friendly names mapping for category ids $catNames = [ 'maize_thresher' => 'Maize Threshers', 'grain_cleaner' => 'Grain & Power Cleaners', 'wheat_thresher' => 'Wheat Threshers', 'paddy_thresher' => 'Paddy Threshers', 'straw_loader' => 'Straw Loaders' ]; $activePage = basename($_SERVER['PHP_SELF'], '.php'); ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Prince Dhandiwalia Agri Works | Premium Agriculture Machinery</title> <!-- Meta SEO --> <meta name="description" content="Prince Dhandiwalia Agri Works is the leading manufacturer of high-quality Maize Threshers, Grain Cleaners, Wheat & Paddy Threshers, and Straw Loaders in Barnala, Punjab. Subsidies available."> <meta name="keywords" content="maize thresher, wheat thresher, paddy thresher, grain cleaner, straw loader, prince dhandiwalia, agriculture machinery punjab"> <!-- Google Fonts --> <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=Barlow+Condensed:ital,wght@0,300;0,400;0,700;1,400&family=Barlow:wght@300;400;500;600;700&family=Bebas+Neue&display=swap" rel="stylesheet"> <!-- Global Stylesheet --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <link rel="stylesheet" href="style.css"> </head> <body> <!-- Custom Cursor Rings --> <div id="cursor"></div> <div id="cursor-ring"></div> <div class="cursor-label" id="cursor-label">EXPLORE</div> <!-- HEADER --> <header id="header"> <a href="index.php" class="nav-logo"> <img src="images/logo/prince_logo.png" alt="Prince Dhandiwalia Logo"> <div>PRINCE DHANDIWALIA <span>AGRI WORKS</span></div> </a> <!-- Desktop Navigation --> <ul class="nav-links"> <li class="<?php echo $activePage === 'index' ? 'active' : ''; ?>"> <a href="index.php">Home</a> </li> <li class="<?php echo $activePage === 'about' ? 'active' : ''; ?>"> <a href="about.php">About Us</a> </li> <li class="<?php echo $activePage === 'quality-policy' ? 'active' : ''; ?>"> <a href="quality-policy.php">Quality Policy</a> </li> <li class="<?php echo $activePage === 'products' || $activePage === 'product-detail' ? 'active' : ''; ?>"> <button type="button">Products <span class="chevron"></span></button> <!-- Desktop Mega Menu --> <div class="mega-menu"> <div> <div class="mega-col-title">Product Categories</div> <?php foreach ($dbCategories as $cat): ?> <a href="products.php?cat=<?php echo urlencode($cat); ?>" class="mega-item"> <?php echo isset($catNames[$cat]) ? $catNames[$cat] : ucwords(str_replace('_', ' ', $cat)); ?> </a> <?php endforeach; ?> <a href="products.php" class="mega-item" style="color: var(--accent-yellow); font-weight: bold;"> View All Catalog → </a> </div> <div> <div class="mega-col-title">Government Subsidy</div> <p style="font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-bottom: 12px;"> Our agricultural implements are government approved for subsidies. Look for our authorized ISI mark: **CM/L-9700223908**. </p> <a href="contact.php" class="mega-item" style="color: var(--accent-green);"> Enquire for Subsidy → </a> </div> </div> </li> <li class="<?php echo $activePage === 'gallery' ? 'active' : ''; ?>"> <a href="gallery.php">Gallery</a> </li> <li class="<?php echo $activePage === 'contact' ? 'active' : ''; ?>"> <a href="contact.php">Contact Us</a> </li> <li> <a href="contact.php" class="nav-cta">Get Quote</a> </li> </ul> <!-- Mobile Hamburger Toggle --> <button id="mobile-menu-toggle" aria-expanded="false" aria-label="Toggle Navigation"> ☰ </button> </header> <!-- Mobile Navigation Sidebar --> <div id="mobile-nav"> <a href="index.php">Home</a> <a href="about.php">About Us</a> <a href="quality-policy.php">Quality Policy</a> <div class="mobile-nav-group"> <div class="mobile-nav-group-title">Products</div> <div class="mobile-nav-sublinks"> <?php foreach ($dbCategories as $cat): ?> <a href="products.php?cat=<?php echo urlencode($cat); ?>"> <?php echo isset($catNames[$cat]) ? $catNames[$cat] : ucwords(str_replace('_', ' ', $cat)); ?> </a> <?php endforeach; ?> <a href="products.php" class="all-prod-link">All Products</a> </div> </div> <a href="gallery.php">Gallery</a> <a href="contact.php">Contact Us</a> <a href="contact.php" class="mobile-cta-btn">Get Quote</a> </div> <script> document.addEventListener('DOMContentLoaded', () => { const toggleBtn = document.getElementById('mobile-menu-toggle'); const mobileNav = document.getElementById('mobile-nav'); if (toggleBtn && mobileNav) { toggleBtn.addEventListener('click', () => { const isOpen = mobileNav.classList.toggle('open'); toggleBtn.innerHTML = isOpen ? '✕' : '☰'; toggleBtn.setAttribute('aria-expanded', isOpen); }); } }); </script>