-
Notifications
You must be signed in to change notification settings - Fork 0
MENUS.md
Jason Brain edited this page Jan 10, 2026
·
1 revision
Core CMS uses a database-driven menu system. Instead of hardcoding HTML links in header.php, we store navigation structures in the database. This allows admins to manage links without touching code.
The system uses two tables (defined in db/schema.sql):
Represents a menu location (e.g., "Main Header", "Footer Links").
-
id: Unique ID. -
name: Human-readable name (e.g., "Top Nav"). -
slug: Unique identifier used in code (e.g.,main-menu).
The actual links inside a container.
-
menu_id: Links to the parentmenustable. -
label: The text to display (e.g., "About Us"). -
url: The destination (e.g.,/about). -
parent_id: Used for nested dropdowns (Sub-menus). -
sort_order: Integer to control display order.
- Create Menu: Admin creates a container (e.g., "Header").
- Add Items: Admin adds links to that container.
-
Reorder: Admin sets the
sort_order.
We use a helper function (to be built in Phase 3) to fetch and render the menu by its slug.
// Usage in templates/header.php
// Second parameter allows custom CSS class (default is 'menu')
render_menu('main-menu', 'site-menu');- Drag-and-Drop Reordering: Using JavaScript in the admin.
- Auto-Add Pages: Automatically adding new pages to a menu.
- Mega Menus: Complex nested layouts.