insert('about_us_sections', [ 'section_id' => generateId('sec_'), 'heading' => trim($_POST['heading'] ?? '') ?: null, 'body' => $body, 'sort_order' => intval($_POST['sort_order'] ?? 0), 'is_active' => 1, ]); setFlash('success', 'Section added'); } } if ($action === 'update' && $sectionId) { $body = trim($_POST['body'] ?? ''); if ($body) { db()->update('about_us_sections', [ 'heading' => trim($_POST['heading'] ?? '') ?: null, 'body' => $body, 'sort_order' => intval($_POST['sort_order'] ?? 0), 'is_active' => isset($_POST['is_active']) ? 1 : 0, ], 'section_id = :id', ['id' => $sectionId]); setFlash('success', 'Section updated'); } } if ($action === 'delete' && $sectionId) { db()->delete('about_us_sections', 'section_id = :id', ['id' => $sectionId]); setFlash('success', 'Section deleted'); } if ($action === 'reorder') { $ids = json_decode($_POST['order'] ?? '[]', true); foreach ($ids as $pos => $sid) { db()->update('about_us_sections', ['sort_order' => $pos + 1], 'section_id = :id', ['id' => $sid]); } echo json_encode(['ok' => true]); exit; } header('Location: /admin/about-us.php'); exit; } $sections = db()->fetchAll( "SELECT * FROM about_us_sections ORDER BY sort_order ASC, id ASC" ); ?>
These sections appear on the homepage between Our Story and the Explore Our Coffee button. Drag rows to reorder. Blank lines in the text become paragraph breaks.
= nl2br(htmlspecialchars($para)) ?>
| Heading | Body Text | Order | Status | Actions | |
|---|---|---|---|---|---|
| = htmlspecialchars($sec['heading'] ?? '—') ?> | = $sec['sort_order'] ?> | = $sec['is_active'] ? 'Active' : 'Hidden' ?> |