# Agent Instructions for CodePress CMS ## Build & Run - **Run Server**: `php -S localhost:8080 -t public` - **Lint PHP**: `find . -name "*.php" -exec php -l {} \;` - **Dependencies**: No Composer/NPM required. Native PHP 8.4+ implementation. ## Code Style & Conventions - **PHP Standards**: Follow PSR-12. Use 4 spaces for indentation. - **Naming**: Classes `PascalCase` (e.g., `CodePressCMS`), methods `camelCase` (e.g., `renderMenu`), variables `camelCase`, config keys `snake_case`. - **Architecture**: - Core logic resides in `index.php`. - Configuration in `config.php`. - Public entry point is `public/index.php`. - **Content**: Stored in `public/content/`. Supports `.md` (Markdown), `.php` (Dynamic), `.html` (Static). - **Templating**: Simple string replacement `{{placeholder}}` in `templates/layout.html`. - **Navigation**: Auto-generated from directory structure. Folders require an index file to be clickable in breadcrumbs. - **Security**: Always use `htmlspecialchars()` for outputting user/content data. - **Git**: `main` is the clean CMS core. `e.noorlander` contains personal content. Do not mix them. ## Important: Title vs File/Directory Name Logic - **CRITICAL**: When user asks for "title" corrections, they usually mean **FILE/DIRECTORY NAME WITHOUT LANGUAGE PREFIX AND EXTENSIONS**, not the HTML title from content! - **Examples**: - `nl.test.md` → display as "Test" (not content title) - `nl.test/` directory → display as "Test" (not H1 content) - `en.php-testen` → display as "Php Testen" (not "ICT") - **Method**: Use `formatDisplayName()` to process file/directory names correctly - **Priority**: Directory names take precedence over file names when both exist - **Language prefixes**: Always remove `nl.` or `en.` prefixes from display names