Site Builder
Editing:
index3.php
writable 0666
<?php /*************************************************************************** * MINI‑SITE INDEX (All‑in‑One) – 2025 * ----------------------------------- * • No external loader needed – all logic is inline * • Auto‑discovers active modules via /pages/modules/modules.json * • Four responsive tabs switch with 15‑line vanilla JS * • Gold‑outline aesthetic across cards ***************************************************************************/ /* ---------- CONFIG ---------- */ $MOD_ROOT = $_SERVER['DOCUMENT_ROOT'] . '/pages/modules'; $GLOBAL_CFG = $MOD_ROOT . '/modules.json'; $localDir = __DIR__; // profile folder function safe_json($f){ return is_file($f)?json_decode(file_get_contents($f),true):[]; } $global = safe_json($GLOBAL_CFG); /* decide tab placement for each module */ $tabMap = [ 'about' => 'overview', 'tags' => 'overview', 'hours' => 'overview', 'coupon' => 'deals', 'cta' => 'deals', 'links' => 'content', 'rss' => 'content', 'prompts' => 'content', 'qr' => 'connect', 'contact-form' => 'connect', 'social-links' => 'connect', ]; /* final list filtered by active flag & tier */ $tabs = ['overview'=>[], 'deals'=>[], 'content'=>[], 'connect'=>[]]; foreach ($global as $m){ if(!($m['active']??false)) continue; $name=$m['name']; $tab = $tabMap[$name]??'overview'; $tabs[$tab][] = $m; } ?> <!doctype html><html lang="en"><head> <meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"> <title>Mini‑Site</title> <style> :root{--gold:#ffb63b;--blue:#2357d7;--bg:#f9fbff;font-family:system-ui,Arial,sans-serif} body{margin:0;background:var(--bg);color:#111} /* --- tabs bar --- */ .tabs{display:flex;justify-content:center;gap:1px;background:#ddd;font-size:1.05rem; position:sticky;top:0;z-index:999} .tab-btn{flex:1;padding:.8rem .4rem;background:#eee;border:none;cursor:pointer; font-weight:600} .tab-btn.active{background:#fff;border-bottom:3px solid var(--gold)} /* --- tab panes --- */ .tab{display:none;padding:1rem 0} .tab.active{display:block} /* --- gold card shared style mimic --- */ .gold-card{background:#fff;padding:1.8rem 1.6rem;border:3.5px solid var(--gold); border-radius:27px;box-shadow:0 8px 26px rgba(0,0,0,.06);margin:2rem auto; max-width:clamp(480px,70vw,720px)} </style></head><body> <!-- ========= NAV BAR ========= --> <nav class="tabs"> <button class="tab-btn active" data-tab="overview">Overview</button> <button class="tab-btn" data-tab="deals">Deals</button> <button class="tab-btn" data-tab="content">Content</button> <button class="tab-btn" data-tab="connect">Connect</button> </nav> <!-- ========= TAB PANES ========= --> <?php foreach($tabs as $key=>$mods): ?> <section id="tab-<?= $key ?>" class="tab<?= $key==='overview'?' active':'' ?>"> <?php foreach($mods as $m): $abs = $MOD_ROOT . '/' . $m['relative_path']; if(is_file($abs)) include $abs; ?> <?php endforeach; ?> </section> <?php endforeach; ?> <script> // -------- tab switch (15 lines) -------- window.addEventListener('DOMContentLoaded',()=>{ const btns=[...document.querySelectorAll('.tab-btn')]; const panes={}; document.querySelectorAll('.tab').forEach(p=>panes[p.id.replace('tab-','')]=p); btns.forEach(b=>b.addEventListener('click',()=>{ const name=b.dataset.tab; btns.forEach(x=>x.classList.toggle('active',x===b)); Object.entries(panes).forEach(([k,p])=>p.classList.toggle('active',k===name)); window.scrollTo({top:0,behavior:'smooth'}); })); }); </script> </body></html>
Save changes
Create folder
writable 0777
Create
Cancel