<?php $pageTitle='Meet the DJs — Almost Heaven Radio'; include __DIR__ . '/header.php'; include __DIR__ . '/menu.php'; require_once __DIR__ . '/includes/media_helpers.php'; $djsJsonFile=__DIR__.'/data/djs.json'; $djsTxtFile=__DIR__.'/data/djs.txt'; $djs=[]; $defaultImage='/img/nav-icons/ourdjs.png'; if(file_exists($djsJsonFile)){ $json=json_decode((string)file_get_contents($djsJsonFile),true); if(is_array($json)) foreach($json as $row){ if(!is_array($row)) continue; $name=trim((string)($row['name'] ?? '')); $bio=trim((string)($row['bio'] ?? '')); if($name==='' && $bio==='') continue; $img=trim((string)($row['image'] ?? '')); if($img!==''){ $img = ah_media_src($img, 'img/djs'); } else { $img=$defaultImage; } $djs[]=['name'=>$name,'show'=>trim((string)($row['show'] ?? '')),'bio'=>$bio,'image'=>$img]; } }
if(empty($djs) && file_exists($djsTxtFile)){ $entries=preg_split("/
---\s*
/",(string)file_get_contents($djsTxtFile)); foreach($entries as $entry){ $lines=array_values(array_filter(array_map('trim',preg_split('/\R/',trim($entry))),fn($v)=>$v!=='')); if(count($lines)<2) continue; $djs[]=['name'=>$lines[0],'show'=>'','bio'=>trim(implode("
",array_slice($lines,1))),'image'=>$defaultImage]; }} ?>
<main class="content-area"><div class="content-wrapper page-shell"><section class="content-card"><h1>🎧 Meet the DJs</h1><p>The voices behind Almost Heaven Radio.</p></section><div class="cards-grid"><?php if($djs): foreach($djs as $dj): ?><article class="friend-card"><div class="friend-top"><div class="friend-image"><img src="<?= htmlspecialchars($dj['image']) ?>" alt="<?= htmlspecialchars($dj['name']) ?>"></div><div class="friend-meta"><div class="top-fan-badge">On Air Talent</div><h3 class="friend-name"><?= htmlspecialchars($dj['name']) ?></h3><?php if(!empty($dj['show'])): ?><p class="dj-showline">Show: <?= htmlspecialchars($dj['show']) ?></p><?php endif; ?><p class="friend-desc"><?= nl2br(htmlspecialchars($dj['bio'])) ?></p></div></div></article><?php endforeach; else: ?><section class="content-card"><p>No DJs listed yet.</p></section><?php endif; ?></div></div></main>
<?php include __DIR__ . '/footer.php'; ?>