<?php include 'includes/header.php'; $slug=preg_replace('/[^a-z0-9\-]/i','',$_GET['slug']??''); $pages=file_exists(__DIR__.'/data/pages.json')?json_decode(file_get_contents(__DIR__.'/data/pages.json'),true):[]; if(!is_array($pages))$pages=[]; $match=null; foreach($pages as $page){ if(($page['slug']??'')===$slug){$match=$page; break;}} ?>
<div class="container content-box mt-5"><?php if(!$match): ?><div class="bg-light p-4 rounded"><h1>Page Not Found</h1></div><?php else: ?><div class="text-center mb-4"><h1><?= htmlspecialchars($match['title']??'') ?></h1><p class="subtext"><?= htmlspecialchars($match['summary']??'') ?></p></div><?php if(!empty($match['image'])): ?><div class="text-center mb-4"><img src="<?= htmlspecialchars($match['image']) ?>" class="img-fluid rounded" alt="<?= htmlspecialchars($match['title']??'') ?>"></div><?php endif; ?><div class="bg-light p-4 rounded"><?= nl2br(htmlspecialchars($match['content']??'')) ?></div><?php if(!empty($match['button_text'])&&!empty($match['button_link'])): ?><div class="text-center mt-4"><a class="btn btn-dark" href="<?= htmlspecialchars($match['button_link']) ?>"><?= htmlspecialchars($match['button_text']) ?></a></div><?php endif; ?><?php endif; ?></div><?php include 'includes/footer.php'; ?>
