prepare("INSERT INTO landing_sections (title, subtitle, content, image_path, layout, button_text, button_link, section_order, is_active) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"); $stmt->execute([$title, $subtitle, $content, $image_path, $layout, $button_text, $button_link, $section_order, $is_active]); set_flash('success', 'Section created successfully.'); } else { $stmt = $pdo->prepare("UPDATE landing_sections SET title=?, subtitle=?, content=?, image_path=?, layout=?, button_text=?, button_link=?, section_order=?, is_active=? WHERE id=?"); $stmt->execute([$title, $subtitle, $content, $image_path, $layout, $button_text, $button_link, $section_order, $is_active, $id]); set_flash('success', 'Section updated successfully.'); } header('Location: ' . url_with_lang('admin_landing_pages.php')); exit; } elseif ($action === 'delete') { $id = $_POST['id'] ?? null; if ($id) { $stmt = $pdo->prepare("DELETE FROM landing_sections WHERE id=?"); $stmt->execute([$id]); set_flash('success', 'Section deleted successfully.'); } header('Location: ' . url_with_lang('admin_landing_pages.php')); exit; } } $stmt = $pdo->query("SELECT * FROM landing_sections ORDER BY section_order ASC, id ASC"); $sections = $stmt->fetchAll(); $editId = $_GET['edit'] ?? null; $editSection = null; if ($editId) { $stmt = $pdo->prepare("SELECT * FROM landing_sections WHERE id = ?"); $stmt->execute([$editId]); $editSection = $stmt->fetch(); } render_header(t('app_name') . ' - Landing Pages', 'admin'); ?>
No custom sections added yet.