Site Builder
Editing:
index2.php
writable 0666
<?php /*************************************************************************** * MASTER INDEX – Award‑Winning Mini‑Site Template (2025‑ready) * ----------------------------------------------------------------------- * • Requires /pages/modules/ (your nine feature modules + future ones) * • Reads modules.json to honour active flags / tiers * • Organises modules into 4 intuitive NAV tabs: * 1. Overview (hero, about, tags, social, hours) * 2. Deals (coupons, CTA) * 3. Content (RSS, recommended links, prompts) * 4. Connect (contact form, QR / vCard) * • Uses ultra‑light Alpine.js‑like vanilla JS for tab switching * • Gold‑outline card aesthetic preserved within each module * • Fully fluid, mobile‑first, high‑contrast accessible theme ***************************************************************************/ define('MOD_ROOT', $_SERVER['DOCUMENT_ROOT'] . '/pages/modules'); $globalCfg = json_decode(file_get_contents(MOD_ROOT.'/modules.json'), true); // helper: find module path by name function mod_path($name,$cfg){ foreach($cfg as $m) if($m['name']===$name && ($m['active']??false)) return MOD_ROOT . '/' . $m['relative_path']; return null; } // profile handy for hero etc $profile = file_exists('profile.json') ? json_decode(file_get_contents('profile.json'),true):[]; $name = $profile['display_name'] ?? $profile['handle'] ?? 'Profile'; $slogan = $profile['slogan'] ?? ''; ?><!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width,initial-scale=1"> <title><?= htmlspecialchars($name) ?> | Mini‑Site</title> <link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" media="all"> <style> :root{ --gold:#ffb63b;--violet:#7239f5;--bg:#f9fbfe;--fg:#222; --tab-bg:#ecf2ff;--tab-active:#ffffff;--tab-border:#d4e0ff; font-family:system-ui,Arial,sans-serif; } body{margin:0;background:var(--bg);color:var(--fg)} /* ---------- NAV ---------- */ .navbar{display:flex;justify-content:center;gap:.4rem;flex-wrap:wrap; background:var(--tab-border);padding:.4rem .6rem;border-bottom:3px solid var(--gold)} .navbar button{background:var(--tab-bg);border:2px solid var(--tab-border); padding:.5rem 1rem;font-weight:700;border-radius:8px;cursor:pointer;font-size:1rem;color:#104; transition:background .15s,border-color .15s} .navbar button.active{background:var(--tab-active);border-color:var(--gold)} .navbar button:hover{background:#dde6ff} /* ---------- CONTENT PANELS ---------- */ .panel{display:none;padding:1rem 0} .panel.active{display:block} /* ---------- HERO ---------- */ .hero{padding:3rem 1rem 2.2rem;text-align:center;color:#fff; background:linear-gradient(120deg,var(--violet) 0%,#3b1ecf 100%)} .hero h1{font-size:2.4rem;margin:0;font-weight:900} .hero p{font-size:1.15rem;margin:.6rem 0 0} </style> </head> <body> <header class="hero"> <h1><?= htmlspecialchars($name) ?></h1> <?php if($slogan): ?><p><?= htmlspecialchars($slogan) ?></p><?php endif; ?> </header> <nav class="navbar" id="navBar"> <button data-tab="overview" class="active">Overview</button> <button data-tab="deals">Deals</button> <button data-tab="content">Content</button> <button data-tab="connect">Connect</button> </nav> <main style="max-width:960px;margin:0 auto;padding:0 1rem" id="mainPanels"> <!-- Overview --> <section class="panel active" id="panel-overview"> <?php include mod_path('about',$globalCfg); ?> <?php include mod_path('tags',$globalCfg); ?> <?php include mod_path('social-links',$globalCfg); ?> <?php $hrs=mod_path('hours',$globalCfg); if($hrs) include $hrs; ?> </section> <!-- Deals --> <section class="panel" id="panel-deals"> <?php include mod_path('coupon',$globalCfg); ?> <?php $cta=mod_path('cta',$globalCfg); if($cta) include $cta; ?> </section> <!-- Content --> <section class="panel" id="panel-content"> <?php include mod_path('rss',$globalCfg); ?> <?php include mod_path('links',$globalCfg); ?> <?php include mod_path('prompts',$globalCfg); ?> </section> <!-- Connect --> <section class="panel" id="panel-connect"> <?php include mod_path('contact-form',$globalCfg); ?> <?php include mod_path('qr',$globalCfg); ?> </section> </main> <script> /* vanilla JS tab switcher */ const nav=document.getElementById('navBar'); nav.addEventListener('click',e=>{ if(e.target.tagName!=='BUTTON')return; const tab=e.target.dataset.tab; document.querySelectorAll('.navbar button').forEach(b=>b.classList.toggle('active',b===e.target)); document.querySelectorAll('.panel').forEach(p=>p.classList.toggle('active',p.id==='panel-'+tab)); window.scrollTo({top:nav.offsetTop,behavior:'smooth'}); }); </script> </body> </html>
Save changes
Create folder
writable 0777
Create
Cancel