Update all guides (NL + EN) for CodePress 2.5.2 features
- Admin guide: RBAC roles, role-based dashboard, plugin types (content/system) - CodePress developer guide: plugin types, admin plugin API, SCSS compilation, asset serving - Theme developer guide: SCSS sole CSS source, css_compiled read-only, guide layout - Content manager guide: layout selection from theme.json, plugin order in frontmatter - Both NL and EN updated with identical structure - 35 files updated
This commit is contained in:
@@ -2,14 +2,14 @@
|
||||
|
||||
De admin beheerder handleiding bevat de volgende onderwerpen:
|
||||
|
||||
- **Dashboard** - Overzicht van de website
|
||||
- **Content beheer** - Bestanden en pagina's beheren
|
||||
- **Configuratie** - Site instellingen
|
||||
- **Thema beheer** - Thema's beheren en aanmaken
|
||||
- **Beveiliging** - Bot bescherming en sessies
|
||||
- **Plugins** - Plugins beheren en aanmaken
|
||||
- **Gebruikers** - Gebruikers toevoegen en verwijderen
|
||||
- **Statistieken** - Bezoekersstatistieken bekijken
|
||||
- **Dashboard** - Role-based overzicht van de website (Admin, Content Beheerder, BI Beheerder, Site Admin)
|
||||
- **Content beheer** - Bestanden en pagina's beheren met layout selectie en plugins
|
||||
- **Configuratie** - Site instellingen (titel, taal, auteur, analytics, logging)
|
||||
- **Thema beheer** - Thema's beheren, activeren en aanmaken (SCSS compilatie)
|
||||
- **Beveiliging** - Bot bescherming, rate limiting en sessie instellingen
|
||||
- **Plugins** - Plugins beheren: content (sidebar) en systeem (admin menu/API)
|
||||
- **Gebruikers** - Gebruikersbeheer met rollen (Admin, Content Beheerder, BI Beheerder, Site Admin)
|
||||
- **Statistieken** - Bezoekersstatistieken bekijken en exporteren
|
||||
- **Logs** - Logbestanden bekijken en filteren
|
||||
|
||||
Selecteer een onderwerp uit de navigatie aan de linkerkant.
|
||||
@@ -2,16 +2,45 @@
|
||||
|
||||
## Bestanden beheren
|
||||
|
||||
- **Uploaden** - Media bestanden uploaden
|
||||
- **Nieuwe map** - Mappen structuur aanmaken
|
||||
- **Nieuw bestand** - Pagina aanmaken
|
||||
- **Bewerken** - Bestaande content wijzigen
|
||||
- **Hernoemen** - Bestandsnamen aanpassen
|
||||
- **Verplaatsen** - Content verplaatsen
|
||||
- **Verwijderen** - Content verwijderen
|
||||
- **Nieuwe map** — Mappen structuur aanmaken
|
||||
- **Nieuw bestand** — Pagina aanmaken (`.md`, `.php`, `.html`)
|
||||
- **Bewerken** — Bestaande content wijzigen in CodeMirror editor
|
||||
- **Hernoemen** — Bestands- of mapnamen aanpassen
|
||||
- **Verplaatsen** — Content verplaatsen naar andere map
|
||||
- **Verwijderen** — Content verwijderen
|
||||
- **Map hernoemen** — Map naam wijzigen
|
||||
|
||||
## Editor
|
||||
## Editor (content-edit)
|
||||
|
||||
- CodeMirror met syntax highlighting
|
||||
- Toolbar voor Markdown formatting
|
||||
- Sneltoetsen: Ctrl+S (opslaan), Ctrl+N (nieuw)
|
||||
- **CodeMirror** met syntax highlighting (Markdown, PHP, HTML)
|
||||
- **Toolbar** voor snel Markdown invoeren
|
||||
- **Sneltoetsen**: Ctrl+S (opslaan), Ctrl+N (nieuw)
|
||||
|
||||
## Layout selectie
|
||||
|
||||
Op de content-edit pagina kun je de layout kiezen uit de layouts gedefinieerd in `theme.json` (template mapping). De geselecteerde layout wordt opgeslagen in de frontmatter `layout:` key.
|
||||
|
||||
## Plugins op pagina's
|
||||
|
||||
- Content plugins (uit `plugin.json` met `type: "content"`) verschijnen in de plugin selectie
|
||||
- Kies welke plugins in de sidebar verschijnen
|
||||
- **Volgorde aanpasbaar** met up/down knoppen
|
||||
- De plugin volgorde wordt opgeslagen in de frontmatter `plugins:` key
|
||||
- Plugins worden **verbergen** als de gekozen layout geen sidebar heeft (bijv. `full_content`)
|
||||
|
||||
## Frontmatter
|
||||
|
||||
De editor werkt de frontmatter live bij bij wijzigingen van layout of plugin selectie:
|
||||
|
||||
```markdown
|
||||
---
|
||||
layout: left_sidebar
|
||||
plugins:
|
||||
- HTMLBlock
|
||||
- Navigation
|
||||
---
|
||||
|
||||
# Pagina titel
|
||||
|
||||
Content...
|
||||
```
|
||||
@@ -1,10 +1,32 @@
|
||||
# Dashboard
|
||||
|
||||
Het dashboard toont een overzicht van:
|
||||
Het dashboard toont een **role-based overzicht** van de website. Welke widgets zichtbaar zijn, hangt af van de rol van de ingelogde gebruiker.
|
||||
|
||||
- Weergaven (30 dagen)
|
||||
- Unieke bezoekers
|
||||
## Rollen en widgets
|
||||
|
||||
### Admin
|
||||
- Weergaven (30 dagen) en unieke bezoekers
|
||||
- Aantal pagina's en mappen
|
||||
- Actieve plugins
|
||||
- Recente activiteit
|
||||
- Snelle acties
|
||||
- Systeem informatie
|
||||
- Snelle acties (nieuwe pagina, plugin, thema)
|
||||
|
||||
### Content Beheerder
|
||||
- Aantal pagina's en mappen
|
||||
- Recente content wijzigingen
|
||||
- Snelle acties (nieuwe pagina, map)
|
||||
|
||||
### BI Beheerder
|
||||
- Weergaven (30 dagen) en unieke bezoekers
|
||||
- Top pagina's
|
||||
- Recente bezoeken
|
||||
|
||||
### Site Admin
|
||||
- Actieve plugins en thema's
|
||||
- Systeem informatie
|
||||
- Snelle acties (thema, plugin, update)
|
||||
|
||||
## Toegang
|
||||
|
||||
Het dashboard is de standaard pagina na login (`/admin/dashboard`). Alle rollen hebben toegang tot het dashboard.
|
||||
@@ -1,13 +1,40 @@
|
||||
# Gebruikers
|
||||
|
||||
Gebruikers worden opgeslagen in `admin/config/admin.json` (file-based, geen database). Elke gebruiker heeft een **rol** die bepaalt welke admin routes en sidebar items zichtbaar zijn.
|
||||
|
||||
## Rollen
|
||||
|
||||
CodePress kent vier rollen, gedefinieerd in `AdminAuth::ROLE_PERMISSIONS`:
|
||||
|
||||
| Rol | Label | Permissies |
|
||||
|-----|-------|-----------|
|
||||
| `admin` | Admin | Alles (`*`) |
|
||||
| `content-manager` | Content Beheerder | Content beheer, handleiding |
|
||||
| `bi-manager` | BI Beheerder | Statistieken, logs, handleiding |
|
||||
| `site-admin` | Site Admin | Thema, plugins, statistieken, logs, update, handleiding |
|
||||
|
||||
Rollen worden getoond met hun label via `AdminAuth::ROLE_LABELS`.
|
||||
|
||||
## Gebruiker toevoegen
|
||||
|
||||
1. Ga naar **Gebruikers**
|
||||
2. Vul gebruikersnaam in
|
||||
3. Kies wachtwoord
|
||||
4. Klik **Toevoegen**
|
||||
3. Kies wachtwoord (opgeslagen als bcrypt hash)
|
||||
4. Selecteer een rol
|
||||
5. Klik **Toevoegen**
|
||||
|
||||
## Gebruiker bewerken
|
||||
|
||||
- Wachtwoord wijzigen (nieuwe bcrypt hash)
|
||||
- Rol wijzigen (beïnvloedt direct zichtbare routes en sidebar items)
|
||||
|
||||
## Gebruiker verwijderen
|
||||
|
||||
- Kan niet voor eigen account
|
||||
- Bevestig met wachtwoord
|
||||
- Bevestig met wachtwoord
|
||||
|
||||
## Toegangscontrole
|
||||
|
||||
- Route access wordt gecontroleerd in `public/admin.php` via `AdminAuth::hasPermission()`
|
||||
- Onbevoegde routes geven een **403 error**
|
||||
- Sidebar items worden conditioneel getoond via de `has_permission()` Twig function in `admin.twig`
|
||||
@@ -1,15 +1,49 @@
|
||||
# Plugins
|
||||
|
||||
## Plugin types
|
||||
|
||||
CodePress kent twee soorten plugins, bepaald door het `type` veld in `plugin.json`:
|
||||
|
||||
- **Content plugins** (`type: "content"`) — Verschijnen in de sidebar en in de plugin selectie op content-edit pagina's. Bieden sidebar content via `getSidebarContent()`.
|
||||
- **Systeem plugins** (`type: "system"`) — Worden geladen door PluginManager maar verschijnen NIET in de sidebar. Bieden functionaliteit via admin menu, routes en de CMSAPI. Geregistreerd via `getAdminMenu()` en `getAdminRoutes()`.
|
||||
|
||||
Bij afwezigheid van een `type` veld wordt `content` aangenomen.
|
||||
|
||||
## Essentiële plugins
|
||||
|
||||
Essentiële plugins zijn gedefinieerd in `getProtectedPlugins()` in `public/admin.php`. Huidige essentiële plugin: **Navigation**.
|
||||
|
||||
Deze plugins:
|
||||
- Kunnen NIET worden gedeactiveerd
|
||||
- Kunnen NIET worden bewerkt
|
||||
- Kunnen NIET worden verwijderd
|
||||
|
||||
Op de plugins pagina krijgen ze een **Essentieel** badge i.p.v. de actieknoppen.
|
||||
|
||||
## Plugins beheren
|
||||
|
||||
- **Activeren/Deactiveren** - Plugins aan/uit
|
||||
- **Bewerken** - Plugin code aanpassen
|
||||
- **Configuratie** - Plugin instellingen
|
||||
- **Verwijderen** - Plugin verwijderen
|
||||
- **Activeren/Deactiveren** — Plugin aan/uit zetten (niet voor essentiële plugins)
|
||||
- **Bewerken** — Plugin code aanpassen in CodeMirror (niet voor essentiële plugins)
|
||||
- **Configuratie** — Plugin instellingen bewerken
|
||||
- **Verwijderen** — Plugin map verwijderen (niet voor essentiële plugins)
|
||||
|
||||
## Nieuwe plugin
|
||||
De admin plugins pagina toont een **Content** of **Systeem** badge per plugin.
|
||||
|
||||
## Nieuwe plugin aanmaken
|
||||
|
||||
1. Ga naar **Plugins** → **Nieuwe plugin**
|
||||
2. Geef naam op (bijv. `MijnPlugin`)
|
||||
3. Bewerk `plugin.php`
|
||||
4. Activeer de plugin
|
||||
2. Geef naam op (bijv. `MijnPlugin`) — dit wordt de mapnaam
|
||||
3. Kies het type: **Content** of **Systeem**
|
||||
4. Het bestand `MijnPlugin.php` wordt aangemaakt (NIET `plugin.php`)
|
||||
5. Bewerk de plugin code in CodeMirror
|
||||
6. Activeer de plugin
|
||||
|
||||
## Plugin bestandsnaam
|
||||
|
||||
Plugin PHP bestanden heten `<PluginName>.php` (bijv. `Navigation.php`, `HTMLBlock.php`). `PluginManager` laadt `$pluginDir . '/' . $pluginName . '.php'`.
|
||||
|
||||
## Plugin CSS
|
||||
|
||||
- Content en systeem plugins kunnen eigen CSS hebben in `assets/scss/` en `assets/css/`
|
||||
- Plugin CSS wordt automatisch geladen ná theme CSS (in `base.twig`), zodat thema's plugin styling kunnen overschrijven
|
||||
- Plugin assets worden geserveerd via `cms/router.php` op URL `/plugins/<Name>/assets/...`
|
||||
@@ -3,17 +3,64 @@
|
||||
## Thema's beheren
|
||||
|
||||
1. Ga naar **Thema** in admin menu
|
||||
2. **Activeren** - Kies actief thema
|
||||
3. **SCSS compileren** - Verwerk SCSS naar CSS
|
||||
4. **Nieuw thema** - Eigen thema aanmaken
|
||||
2. **Activeren** — Kies actief thema (wordt opgeslagen in `config.json`)
|
||||
3. **SCSS compileren** — Verwerk SCSS naar CSS (geforceerd)
|
||||
4. **Nieuw thema** — Eigen thema aanmaken via admin of handmatig
|
||||
|
||||
## Thema structuur
|
||||
|
||||
```
|
||||
themes/default/
|
||||
├── theme.json # Thema configuratie
|
||||
├── base.twig # Hoofd layout
|
||||
├── full_content.twig # Layouts
|
||||
├── partials/ # Header, nav, footer
|
||||
└── assets/ # CSS, JS, afbeeldingen
|
||||
```
|
||||
├── theme.json # { title, config.default_template, template: layout→.twig }
|
||||
├── base.twig # Hoofd layout (head, header, nav, breadcrumb, footer)
|
||||
├── full_content.twig # Layout: volledige breedte
|
||||
├── left_sidebar.twig # Layout: sidebar links
|
||||
├── right_sidebar.twig # Layout: sidebar rechts
|
||||
├── custom1.twig # Layout: custom
|
||||
├── guide.twig # Layout: handleiding met sidebar (Navigation plugin)
|
||||
├── partials/ # header.twig, navigation.twig, footer.twig
|
||||
└── assets/
|
||||
├── scss/theme.scss # SCSS bron (enige CSS bron — handmatige css/theme.css mag niet bestaan)
|
||||
├── css_compiled/ # Gegenereerd door scssphp (read-only, niet handmatig aanpassen)
|
||||
├── css/ # Externe CSS (bootstrap.min.css, bootstrap-icons.css, mobile.css)
|
||||
├── js/ # app.js, bootstrap.bundle.min.js
|
||||
├── fonts/ # bootstrap-icons.woff, woff2
|
||||
└── img/ # favicon, icon, world-map
|
||||
```
|
||||
|
||||
## theme.json
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "default",
|
||||
"config": {
|
||||
"default_template": "full_content"
|
||||
},
|
||||
"template": {
|
||||
"full_content": "full_content.twig",
|
||||
"left_sidebar": "left_sidebar.twig",
|
||||
"right_sidebar": "right_sidebar.twig",
|
||||
"custom1": "custom1.twig",
|
||||
"guide": "guide.twig"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `title` — Weergavenaam in admin
|
||||
- `config.default_template` — Standaard layout voor pagina's zonder `layout:` frontmatter
|
||||
- `template` — Mapping van layout naam naar `.twig` bestand
|
||||
|
||||
## SCSS compilatie
|
||||
|
||||
- `ThemeManager` compileert `assets/scss/theme.scss` runtime naar `assets/css_compiled/theme.css` via scssphp
|
||||
- `css_compiled/` is **read-only** — niet handmatig aanpassen
|
||||
- `assets/css/theme.css` mag **niet** bestaan; anders negeert `ThemeManager::getCssUrl()` de SCSS
|
||||
- Na SCSS wijzigingen: verwijder `assets/css_compiled/theme.css` en `.mtime` om te forceren
|
||||
|
||||
## Layouts
|
||||
|
||||
Layouts worden gekozen via frontmatter `layout:` key in content bestanden. Onbekende layouts vallen terug op `config.default_template` uit `theme.json`.
|
||||
|
||||
## guide.twig
|
||||
|
||||
Speciale layout voor handleidingen. Injecteert de Navigation plugin in de sidebar voor zijbalk navigatie. Wordt automatisch gebruikt voor pagina's in de `guide/` map.
|
||||
@@ -2,13 +2,20 @@
|
||||
|
||||
De CodePress developer handleiding bevat de volgende onderwerpen:
|
||||
|
||||
- **Architectuur** - CMS architectuur en mappenstructuur
|
||||
- **Core classes** - CodePressCMS, ThemeManager, PluginManager
|
||||
- **Plugin development** - Plugins ontwikkelen
|
||||
- **Routing** - Frontend en admin routing
|
||||
- **Beveiliging** - XSS, CSRF, path traversal
|
||||
- **Testing** - Penetratie, accessibility en functionele tests
|
||||
- **Debugging** - Logging en cache
|
||||
- **Performance** - OPcache en SCSS caching
|
||||
- **Architectuur** — CMS architectuur en mappenstructuur
|
||||
- **Core classes** — CodePressCMS, ThemeManager, PluginManager, AdminAuth
|
||||
- **Plugin development** — Plugin types (content/systeem), structuur, API
|
||||
- **Routing** — Frontend, admin en plugin admin routing
|
||||
- **Beveiliging** — XSS, CSRF, path traversal, RBAC
|
||||
- **Testing** — Penetratie, accessibility en functionele tests
|
||||
- **Debugging** — Logging en cache
|
||||
- **Performance** — OPcache en SCSS caching
|
||||
|
||||
Belangrijke concepten in CodePress 2.5.2:
|
||||
|
||||
- **Plugin types** — Content plugins (sidebar) en systeem plugins (admin menu, routes, API)
|
||||
- **Admin plugin API** — Systeem plugins kunnen admin menu items en routes registreren
|
||||
- **SCSS compilatie** — `ThemeManager` compileert SCSS naar `css_compiled/` via scssphp (read-only)
|
||||
- **Asset serving** — `public/asset.php` serveert themes/, admin/assets/ en plugins/ op Apache (i.p.v. PHP dev router)
|
||||
|
||||
Selecteer een onderwerp uit de navigatie aan de linkerkant.
|
||||
@@ -1,11 +1,84 @@
|
||||
# CMS Architectuur
|
||||
|
||||
CodePress is een file-based CMS zonder database. Content, configuratie en gebruikers worden opgeslagen in bestanden.
|
||||
|
||||
## Mappenstructuur
|
||||
|
||||
```
|
||||
codepress/
|
||||
├── cms/core/ # Core engine
|
||||
├── admin/ # Admin console
|
||||
├── themes/ # Thema's
|
||||
├── plugins/ # Plugins
|
||||
├── content/ # Content
|
||||
└── public/ # Web root
|
||||
```
|
||||
├── cms/ # Core CMS engine
|
||||
│ ├── core/
|
||||
│ │ ├── class/
|
||||
│ │ │ ├── CodePressCMS.php # Hoofd CMS class (routing, rendering, breadcrumb)
|
||||
│ │ │ ├── ThemeManager.php # Thema-resolver + Twig render + SCSS compile
|
||||
│ │ │ ├── ContentAPI.php # Read-only API voor PHP content
|
||||
│ │ │ ├── ContentSecurityPolicy.php # CSP header management
|
||||
│ │ │ ├── Analytics.php # Bezoekersstatistieken
|
||||
│ │ │ ├── BotGuard.php # Bot/AI detectie
|
||||
│ │ │ ├── Cache.php # Cache systeem
|
||||
│ │ │ ├── GeoIP.php # GeoIP lookup (land, vlag)
|
||||
│ │ │ ├── Logger.php # Basis logging
|
||||
│ │ │ ├── LogManager.php # Dynamisch logging (SQLite/syslog)
|
||||
│ │ │ ├── RateLimiter.php # Rate limiting per IP
|
||||
│ │ │ ├── RequestLogger.php # Request logging + visitor info
|
||||
│ │ │ ├── SearchEngine.php # Volledige tekst zoekfunctie
|
||||
│ │ │ └── AccessibilityManager.php # Accessibility features
|
||||
│ │ ├── plugin/
|
||||
│ │ │ ├── PluginManager.php # Plugin loader (hooks, filters, sidebar, admin routes)
|
||||
│ │ │ └── CMSAPI.php # API voor plugins (getPage, getConfig, etc.)
|
||||
│ │ ├── config.php # Config loader (leest config.json)
|
||||
│ │ └── index.php # Bootstrap (autoloader, requires)
|
||||
│ ├── lang/ # Taalbestanden (nl.php, en.php)
|
||||
│ └── router.php # PHP dev server router
|
||||
├── themes/ # Dynamische thema's
|
||||
│ └── default/ # Standaard thema (views + assets)
|
||||
│ ├── theme.json # { title, config.default_template, template: layout→.twig }
|
||||
│ ├── base.twig # Hoofd layout
|
||||
│ ├── *.twig # Layout templates
|
||||
│ ├── partials/ # header.twig, navigation.twig, footer.twig
|
||||
│ └── assets/
|
||||
│ ├── scss/theme.scss # SCSS bron (enige CSS bron)
|
||||
│ ├── css_compiled/ # Gegenereerd door scssphp (read-only)
|
||||
│ ├── css/ # Externe CSS (bootstrap.min.css, etc.)
|
||||
│ ├── js/ # JavaScript
|
||||
│ └── img/ # Afbeeldingen
|
||||
├── admin/ # Admin paneel
|
||||
│ ├── config/
|
||||
│ │ ├── app.php # Admin app configuratie
|
||||
│ │ └── admin.json # Gebruikers & security (file-based, .gitignore'd)
|
||||
│ ├── src/
|
||||
│ │ └── AdminAuth.php # Authenticatie + RBAC
|
||||
│ ├── theme/default/ # Admin thema (views + assets)
|
||||
│ │ ├── theme.json
|
||||
│ │ ├── assets/ # CSS, JS, CodeMirror, fonts
|
||||
│ │ └── views/ # login.twig, layouts/, pages/
|
||||
│ └── storage/ # Logs, cache, geoip
|
||||
├── plugins/ # CMS plugins
|
||||
│ ├── Navigation/ # Essentiële navigatie plugin (beschermd)
|
||||
│ │ ├── Navigation.php # Plugin code (NIET plugin.php)
|
||||
│ │ ├── plugin.json # Metadata met type veld
|
||||
│ │ └── assets/ # SCSS + CSS
|
||||
│ └── HTMLBlock/ # Voorbeeld sidebar plugin
|
||||
├── content/ # Website content (.md, .php, .html) — .gitignore'd
|
||||
├── guide/ # Handleidingen (nl/en)
|
||||
├── public/ # Web root
|
||||
│ ├── index.php # Website entry point
|
||||
│ ├── admin.php # Admin entry point + routing
|
||||
│ ├── asset.php # Asset server voor Apache (themes/, admin/assets/, plugins/)
|
||||
│ ├── .htaccess # Stuurt asset URLs door naar asset.php
|
||||
│ ├── favicon.ico
|
||||
│ └── robots.txt
|
||||
├── var/ # Cache (twig) — .gitignore'd
|
||||
├── config.json # Site configuratie — .gitignore'd
|
||||
├── composer.json # PHP dependencies (CommonMark, Twig, scssphp)
|
||||
└── version.php # Versie informatie (2.5.2)
|
||||
```
|
||||
|
||||
## Principes
|
||||
|
||||
- **Geen database** — Alles in bestanden (content in `content/`, gebruikers in `admin/config/admin.json`, config in `config.json`)
|
||||
- **File-based auth** — `AdminAuth` gebruikt bcrypt hashes in `admin.json`, sessies voor login
|
||||
- **Twig templating** — Themes gebruiken Twig; `ThemeManager` rendert via Twig
|
||||
- **SCSS compilatie** — `assets/scss/theme.scss` → `assets/css_compiled/theme.css` via scssphp (read-only output)
|
||||
- **Plugin systeem** — `PluginManager` laadt content en systeem plugins met hooks/filters
|
||||
- **Asset serving** — PHP dev router (`cms/router.php`) of Apache (`.htaccess` → `public/asset.php`)
|
||||
@@ -10,6 +10,13 @@ $cms->init();
|
||||
$cms->renderPage($pagePath);
|
||||
```
|
||||
|
||||
Verantwoordelijkheden:
|
||||
- Routing en pagina rendering
|
||||
- Breadcrumb generatie (dynamisch: Home > [submappen] > [pagina])
|
||||
- Guide pagina's laden (`getGuidePage()`)
|
||||
- Titel extractie uit H1 (`getTitleFromFile()`)
|
||||
- Weergavenaam verwerking (`formatDisplayName()`)
|
||||
|
||||
## ThemeManager.php
|
||||
|
||||
Themabeheer in `cms/core/class/ThemeManager.php`:
|
||||
@@ -19,14 +26,84 @@ $themeManager = new ThemeManager($config);
|
||||
$themeManager->getActiveTheme();
|
||||
$themeManager->renderTwig($template, $data);
|
||||
$themeManager->compileCss($force);
|
||||
$themeManager->getCssUrl();
|
||||
```
|
||||
|
||||
Verantwoordelijkheden:
|
||||
- Actief thema resolveren vanuit `config.json`
|
||||
- `theme.json` laden (title, config.default_template, template mapping)
|
||||
- Twig environment bouwen (geroot in thema map)
|
||||
- **SCSS compilatie** — compileert `assets/scss/theme.scss` naar `assets/css_compiled/theme.css` via scssphp
|
||||
- Layout resolveren naar `.twig` template (fallback op `config.default_template`)
|
||||
|
||||
`getCssUrl()` prioriteit: 1) `assets/css/theme.css` (handmatig), 2) `assets/css_compiled/theme.css` (gecompileerd).
|
||||
|
||||
## PluginManager.php
|
||||
|
||||
Plugin systeem in `cms/core/class/PluginManager.php`:
|
||||
Plugin systeem in `cms/core/plugin/PluginManager.php`:
|
||||
|
||||
```php
|
||||
$pluginManager = new PluginManager();
|
||||
$pluginManager->loadPlugins($enabledPlugins);
|
||||
$pluginManager = new PluginManager($pluginsPath, $enabledPlugins);
|
||||
$pluginManager->getSidebarContent($allowedPlugins);
|
||||
$pluginManager->getPluginCssUrls();
|
||||
$pluginManager->executeHook($name, $params);
|
||||
```
|
||||
$pluginManager->getAdminMenuItems();
|
||||
$pluginManager->handleAdminRoute($route);
|
||||
$pluginManager->getPluginType($pluginName);
|
||||
```
|
||||
|
||||
Verantwoordelijkheden:
|
||||
- Plugins laden vanuit `plugins/` mappen (alleen ingeschakelde plugins)
|
||||
- Plugin bestand: `<PluginName>.php` (NIET `plugin.php`)
|
||||
- Hooks en filters systeem (`doAction`, `applyFilters`)
|
||||
- Sidebar content verzamelen van content plugins (`getSidebarContent`)
|
||||
- Plugin CSS URLs verzamelen (`getPluginCssUrls`)
|
||||
- **Admin menu items** van systeem plugins (`getAdminMenuItems`)
|
||||
- **Admin routes** afhandelen via systeem plugins (`handleAdminRoute`)
|
||||
- **Plugin type** bepalen (`getPluginType` — `content` of `system`)
|
||||
- `isPluginViewable` — systeem plugins verschijnen niet in sidebar
|
||||
|
||||
## AdminAuth.php
|
||||
|
||||
Authenticatie en RBAC in `admin/src/AdminAuth.php`:
|
||||
|
||||
```php
|
||||
$auth = new AdminAuth($appConfig);
|
||||
$auth->login($username, $password);
|
||||
$auth->logout();
|
||||
$auth->hasPermission($route);
|
||||
$auth->verifyCsrf($token);
|
||||
```
|
||||
|
||||
Constanten:
|
||||
- `ROLE_PERMISSIONS` — Mapping van rol → toegestane route prefixes. `admin` heeft wildcard `*`.
|
||||
- `ROLE_LABELS` — Human-readable labels per rol.
|
||||
|
||||
Rollen:
|
||||
|
||||
| Rol | Label | Permissies |
|
||||
|-----|-------|-----------|
|
||||
| `admin` | Admin | Alles (`*`) |
|
||||
| `content-manager` | Content Beheerder | Content beheer, handleiding |
|
||||
| `bi-manager` | BI Beheerder | Statistieken, logs, handleiding |
|
||||
| `site-admin` | Site Admin | Thema, plugins, statistieken, logs, update, handleiding |
|
||||
|
||||
Verantwoordelijkheden:
|
||||
- Session-based authenticatie
|
||||
- bcrypt password hashing
|
||||
- CSRF tokens (`verifyCsrf`)
|
||||
- Brute-force lockout (login attempts tracking)
|
||||
- RBAC via `hasPermission($route)` — checkt route tegen `ROLE_PERMISSIONS`
|
||||
|
||||
## CMSAPI.php
|
||||
|
||||
Plugin API in `cms/core/plugin/CMSAPI.php`:
|
||||
|
||||
```php
|
||||
$api = PluginManager::getAPI();
|
||||
$config = $api->getConfig();
|
||||
$page = $api->getPage($path);
|
||||
$content = $api->getContent();
|
||||
```
|
||||
|
||||
Biedt read-only toegang aan plugins tot CMS data (config, pagina's, content).
|
||||
@@ -1,43 +1,144 @@
|
||||
# Plugin Development
|
||||
|
||||
## Plugin types
|
||||
|
||||
CodePress kent twee soorten plugins, bepaald door het `type` veld in `plugin.json`:
|
||||
|
||||
- **Content plugins** (`type: "content"`) — Verschijnen in de sidebar en in de plugin selectie op content-edit pagina's. Bieden sidebar content via `getSidebarContent()`.
|
||||
- **Systeem plugins** (`type: "system"`) — Worden geladen door PluginManager maar verschijnen NIET in de sidebar. Bieden functionaliteit via admin menu, routes en de CMSAPI.
|
||||
|
||||
Bij afwezigheid van een `type` veld wordt `content` aangenomen.
|
||||
|
||||
## Plugin structuur
|
||||
|
||||
```
|
||||
plugins/MijnPlugin/
|
||||
├── plugin.json # Plugin metadata
|
||||
├── plugin.php # Plugin code
|
||||
└── config.json # Optionele configuratie
|
||||
├── MijnPlugin.php # Plugin code (NIET plugin.php)
|
||||
├── plugin.json # Metadata met type veld
|
||||
├── config.json # Optionele configuratie
|
||||
└── assets/
|
||||
├── scss/mijnplugin.scss # SCSS bron (optioneel)
|
||||
└── css/mijnplugin.css # CSS (handmatig onderhouden)
|
||||
```
|
||||
|
||||
Plugin bestanden heten `<PluginName>.php` (bijv. `Navigation.php`, `HTMLBlock.php`). `PluginManager` laadt `$pluginDir . '/' . $pluginName . '.php'`.
|
||||
|
||||
## plugin.json
|
||||
|
||||
```json
|
||||
{
|
||||
"name": "Mijn Plugin",
|
||||
"version": "1.0.0",
|
||||
"author": "Jouw Naam",
|
||||
"description": "Beschrijving"
|
||||
"name": "Mijn Plugin",
|
||||
"version": "1.0.0",
|
||||
"author": "Jouw Naam",
|
||||
"description": "Beschrijving",
|
||||
"type": "content"
|
||||
}
|
||||
```
|
||||
|
||||
## plugin.php voorbeeld
|
||||
- `name` — Weergavenaam
|
||||
- `type` — `"content"` of `"system"` (default: `content`)
|
||||
|
||||
## Content plugin voorbeeld
|
||||
|
||||
```php
|
||||
<?php
|
||||
/**
|
||||
* Plugin: MijnPlugin
|
||||
* Plugin: MijnPlugin (content)
|
||||
*/
|
||||
class MijnPlugin
|
||||
{
|
||||
public function getConfig(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Mijn Plugin',
|
||||
'type' => 'content',
|
||||
];
|
||||
}
|
||||
|
||||
echo '<div class="mijn-plugin">Hello World</div>';
|
||||
public function getSidebarContent(): string
|
||||
{
|
||||
return '<p>Hello World</p>';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Systeem plugin voorbeeld
|
||||
|
||||
```php
|
||||
<?php
|
||||
/**
|
||||
* Plugin: MijnSysteem (system)
|
||||
*/
|
||||
class MijnSysteem
|
||||
{
|
||||
public function getConfig(): array
|
||||
{
|
||||
return [
|
||||
'title' => 'Mijn Systeem',
|
||||
'type' => 'system',
|
||||
];
|
||||
}
|
||||
|
||||
public function getAdminMenu(): array
|
||||
{
|
||||
return [
|
||||
['label' => 'Mijn Systeem', 'route' => 'mijn-systeem', 'icon' => 'bi-gear'],
|
||||
];
|
||||
}
|
||||
|
||||
public function getAdminRoutes(): array
|
||||
{
|
||||
return ['mijn-systeem'];
|
||||
}
|
||||
|
||||
public function handleAdminRoute(string $route): void
|
||||
{
|
||||
echo '<h1>Mijn Systeem pagina</h1>';
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Systeem plugins worden via `PluginManager::getAdminMenuItems()` in de admin sidebar getoond en via `PluginManager::handleAdminRoute()` afgehandeld.
|
||||
|
||||
## CMSAPI gebruiken
|
||||
|
||||
```php
|
||||
<?php
|
||||
require_once '../../cms/core/class/PluginManager.php';
|
||||
|
||||
$api = PluginManager::getAPI();
|
||||
$config = $api->getConfig();
|
||||
$content = $api->getContent();
|
||||
```
|
||||
$page = $api->getPage($path);
|
||||
```
|
||||
|
||||
`setAPI()` wordt automatisch aangeroepen door `PluginManager` als de plugin de methode heeft.
|
||||
|
||||
## Plugin CSS
|
||||
|
||||
- Plugin CSS in `assets/css/` is handmatig te onderhouden (SCSS compilatie voor plugins is nog niet automatisch)
|
||||
- Plugin CSS wordt automatisch geladen ná theme CSS (in `base.twig`), zodat thema's plugin styling kunnen overschrijven
|
||||
- Plugin assets worden geserveerd via `cms/router.php` op URL `/plugins/<Name>/assets/...`
|
||||
- Implementeer `getCssUrl()` in de plugin klasse om de CSS URL terug te geven
|
||||
|
||||
```php
|
||||
public function getCssUrl(): string
|
||||
{
|
||||
return '/plugins/MijnPlugin/assets/css/mijnplugin.css';
|
||||
}
|
||||
```
|
||||
|
||||
## Hooks en filters
|
||||
|
||||
PluginManager auto-registert deze methoden als hooks/filters:
|
||||
|
||||
- **Hooks**: `onPageLoad`, `onBeforeRender`, `onAfterRender`, `onSearch`, `onMenuBuild`
|
||||
- **Filters**: `onContentFilter`, `onTitleFilter`, `onMenuFilter`
|
||||
|
||||
```php
|
||||
public function onPageLoad($page) { /* ... */ }
|
||||
public function onContentFilter($content) { return $content; }
|
||||
```
|
||||
|
||||
## Essentiële plugins
|
||||
|
||||
Essentiële plugins zijn gedefinieerd in `getProtectedPlugins()` in `public/admin.php`. Huidige essentiële plugin: **Navigation**.
|
||||
|
||||
Deze plugins kunnen niet worden gedeactiveerd, bewerkt of verwijderd. Voeg altijd de `isProtectedPlugin()` check toe aan nieuwe plugin handlers.
|
||||
@@ -2,18 +2,60 @@
|
||||
|
||||
## Frontend routing
|
||||
|
||||
Via `cms/router.php` voor PHP dev server:
|
||||
Frontend routing verloopt via `cms/router.php` (PHP dev server) of `.htaccess` (Apache). Beide zorgen voor clean URLs.
|
||||
|
||||
```php
|
||||
// Schone URLs: /nl/pagina
|
||||
// Query: ?page=pagina&lang=nl
|
||||
### PHP dev server
|
||||
|
||||
Start de server met:
|
||||
|
||||
```bash
|
||||
php -S localhost:8080 cms/router.php
|
||||
```
|
||||
|
||||
`cms/router.php` serveert:
|
||||
- Schone URLs: `/nl/pagina` → `public/index.php?page=pagina&lang=nl`
|
||||
- `themes/` assets
|
||||
- `admin/assets/` assets
|
||||
- `plugins/` assets
|
||||
|
||||
### Apache (live server)
|
||||
|
||||
`public/.htaccess` herschrijft URLs naar `public/index.php`. Asset URLs (`/themes/`, `/admin/assets/`, `/plugins/`) worden doorgestuurd naar `public/asset.php`.
|
||||
|
||||
`public/asset.php` serveert bestanden vanuit de juiste mappen met het juiste MIME-type:
|
||||
- `/themes/<name>/assets/...` → `themes/<name>/assets/...`
|
||||
- `/admin/assets/...` → `admin/theme/default/assets/...`
|
||||
- `/plugins/<name>/assets/...` → `plugins/<name>/assets/...`
|
||||
|
||||
## Admin routing
|
||||
|
||||
Via `public/admin.php`:
|
||||
Admin routing verloopt via `public/admin.php` met clean URLs:
|
||||
|
||||
```
|
||||
/admin/dashboard → ?route=dashboard
|
||||
/admin/content → ?route=content
|
||||
/admin/plugins → ?route=plugins
|
||||
```
|
||||
|
||||
`cms/router.php` of `.htaccess` zet `/admin/<route>` om naar `?route=<route>`.
|
||||
|
||||
### Route access control (RBAC)
|
||||
|
||||
Elke route wordt gecontroleerd via `AdminAuth::hasPermission($route)`:
|
||||
- `admin` rol heeft wildcard `*` toegang
|
||||
- Andere rollen hebben een expliciete lijst van toegestane routes in `ROLE_PERMISSIONS`
|
||||
- Onbevoegde routes geven een **403 error**
|
||||
|
||||
## Plugin admin routing
|
||||
|
||||
Systeem plugins kunnen admin routes registreren. Deze worden afgehandeld door `PluginManager::handleAdminRoute($route)`:
|
||||
|
||||
1. Systeem plugin registreert routes via `getAdminRoutes()`
|
||||
2. `PluginManager::getAdminMenuItems()` verzamelt admin menu items via `getAdminMenu()`
|
||||
3. Bij een admin request zoekt `PluginManager::handleAdminRoute($route)` een plugin die de route afhandelt
|
||||
4. De plugin methode `handleAdminRoute($route)` rendert de pagina inhoud
|
||||
|
||||
```php
|
||||
// Routes: /admin/dashboard, /admin/content, etc.
|
||||
// Query parameter: ?route=dashboard
|
||||
// PluginManager roept deze aan voor /admin/mijn-systeem
|
||||
$plugin->handleAdminRoute('mijn-systeem');
|
||||
```
|
||||
@@ -4,28 +4,48 @@ Content wordt opgeslagen in de `content/` map zonder database.
|
||||
|
||||
## Ondersteunde bestandsformaten
|
||||
|
||||
- `.md` - Markdown (aanbevolen)
|
||||
- `.php` - Dynamische PHP pagina's
|
||||
- `.html` - Statische HTML pagina's
|
||||
- `.md` — Markdown (aanbevolen)
|
||||
- `.php` — Dynamische PHP pagina's
|
||||
- `.html` — Statische HTML pagina's
|
||||
|
||||
## Bestandsnaam conventies
|
||||
|
||||
```
|
||||
nl.pagina-naam.md # Nederlandse pagina
|
||||
en.page-name.md # Engelse pagina
|
||||
nl.map/ # Nederlandse map (vereist index bestand om klikbaar te zijn)
|
||||
```
|
||||
|
||||
Taalprefix wordt dynamisch verwijderd op basis van beschikbare talen via `getAvailableLanguages()`.
|
||||
|
||||
## Frontmatter
|
||||
|
||||
Markdown bestanden kunnen frontmatter metadata bevatten:
|
||||
|
||||
```markdown
|
||||
---
|
||||
layout: full_content
|
||||
plugins: HTMLBlock
|
||||
layout: left_sidebar
|
||||
plugins:
|
||||
- HTMLBlock
|
||||
- Navigation
|
||||
---
|
||||
|
||||
# Pagina titel
|
||||
|
||||
Content...
|
||||
```
|
||||
```
|
||||
|
||||
## Frontmatter velden
|
||||
|
||||
- `layout` — Layout naam (moet voorkomen in `theme.json` template mapping; fallback op `config.default_template`)
|
||||
- `plugins` — Lijst van content plugins die in de sidebar verschijnen
|
||||
|
||||
### plugins veld
|
||||
|
||||
Het `plugins` veld bepaalt:
|
||||
- **Welke plugins** in de sidebar verschijnen (alleen content plugins, niet systeem plugins)
|
||||
- **De volgorde** van de plugins in de sidebar (top tot onder)
|
||||
|
||||
De volgorde in de frontmatter is de volgorde waarin de plugins worden getoond. In de admin content-edit pagina kun je de volgorde aanpassen met up/down knoppen; de frontmatter wordt live bijgewerkt.
|
||||
|
||||
Plugins worden niet getoond als de gekozen layout geen sidebar heeft (bijv. `full_content`).
|
||||
@@ -5,12 +5,44 @@
|
||||
1. Login op `/admin`
|
||||
2. Ga naar **Content**
|
||||
3. Kies een map of maak een nieuwe pagina
|
||||
4. Bewerk content in de editor
|
||||
4. Bewerk content in de CodeMirror editor
|
||||
5. Sla op met Ctrl+S
|
||||
|
||||
## Editor functies
|
||||
|
||||
- **CodeMirror** editor met syntax highlighting
|
||||
- **CodeMirror** editor met syntax highlighting (Markdown, PHP, HTML)
|
||||
- **Toolbar** voor snel Markdown invoegen
|
||||
- **Live preview** via knop
|
||||
- **Auto-save** backups in `.bak/` map
|
||||
- **Sneltoetsen**: Ctrl+S (opslaan), Ctrl+N (nieuw)
|
||||
- **Auto-save** backups in `.bak/` map
|
||||
|
||||
## Layout selectie
|
||||
|
||||
Op de content-edit pagina kun je de layout kiezen uit de layouts gedefinieerd in `theme.json` (template mapping). De geselecteerde layout wordt opgeslagen in de frontmatter `layout:` key.
|
||||
|
||||
```markdown
|
||||
---
|
||||
layout: left_sidebar
|
||||
---
|
||||
```
|
||||
|
||||
Onbekende layouts vallen terug op `config.default_template` uit `theme.json`.
|
||||
|
||||
## Plugin selectie en volgorde
|
||||
|
||||
Op de content-edit pagina kun je content plugins kiezen voor de sidebar:
|
||||
|
||||
- **Selectie** — Alleen content plugins (uit `plugin.json` met `type: "content"`) verschijnen in de plugin selectie
|
||||
- **Volgorde** — Pas de volgorde aan met up/down knoppen
|
||||
- **Frontmatter update** — De frontmatter `plugins:` key wordt live bijgewerkt bij wijzigingen
|
||||
- **Layout zonder sidebar** — Plugins worden verborgen als de gekozen layout geen sidebar heeft (bijv. `full_content`)
|
||||
|
||||
```markdown
|
||||
---
|
||||
layout: left_sidebar
|
||||
plugins:
|
||||
- HTMLBlock
|
||||
- Navigation
|
||||
---
|
||||
```
|
||||
|
||||
De volgorde in de frontmatter bepaalt de volgorde van de plugins in de sidebar (top tot onder).
|
||||
@@ -1,3 +1,12 @@
|
||||
# Handleiding
|
||||
|
||||
Welkom bij de CodePress CMS handleiding (versie 2.5.2). CodePress is een file-based CMS zonder database — content, configuratie en gebruikers worden opgeslagen in bestanden.
|
||||
|
||||
De handleiding is verdeeld in vier secties:
|
||||
|
||||
- **Admin Beheerder** — Beheer van de website: dashboard, content, configuratie, thema's, beveiliging, plugins (content en systeem), gebruikers met rollen, statistieken en logs
|
||||
- **Content Beheerder** — Content beheren: structuur, pagina's beheren (layout selectie, plugin volgorde), media en de Content API
|
||||
- **Theme Developer** — Thema's ontwikkelen: structuur, `theme.json`, Twig templates, SCSS styling (enige CSS bron), layouts en nieuwe thema's
|
||||
- **CodePress Developer** — Core ontwikkeling: architectuur, core classes, plugin development (content/systeem), routing, beveiliging (RBAC), testing, debugging en performance
|
||||
|
||||
Selecteer een onderwerp uit de navigatie aan de linkerkant.
|
||||
@@ -1,5 +1,7 @@
|
||||
# Layouts
|
||||
|
||||
Layouts definiëren de pagina structuur (sidebar links, volledige breedte, etc.). Layouts worden gedefinieerd in `theme.json` en gekozen via frontmatter in content bestanden.
|
||||
|
||||
## Layout kiezen in content
|
||||
|
||||
```markdown
|
||||
@@ -14,14 +16,58 @@ Content...
|
||||
|
||||
## Layouts in theme.json
|
||||
|
||||
Layouts worden gedefinieerd in de `template` mapping. De `config.default_template` is de fallback voor pagina's zonder `layout:` frontmatter of met een onbekende layout:
|
||||
|
||||
```json
|
||||
{
|
||||
"default_layout": "full_content",
|
||||
"layouts": {
|
||||
"full_content": "full_content.twig",
|
||||
"left_sidebar": "left_sidebar.twig",
|
||||
"right_sidebar": "right_sidebar.twig",
|
||||
"custom1": "custom1.twig"
|
||||
}
|
||||
"config": {
|
||||
"default_template": "full_content"
|
||||
},
|
||||
"template": {
|
||||
"full_content": "full_content.twig",
|
||||
"left_sidebar": "left_sidebar.twig",
|
||||
"right_sidebar": "right_sidebar.twig",
|
||||
"custom1": "custom1.twig",
|
||||
"guide": "guide.twig"
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
## Layout template
|
||||
|
||||
Een layout template extends `base.twig` en vult het `content` block:
|
||||
|
||||
```twig
|
||||
{% extends 'base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
{{ content|raw }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
## Layouts met sidebar
|
||||
|
||||
Layouts met sidebar kunnen plugin content tonen:
|
||||
|
||||
```twig
|
||||
{% extends 'base.twig' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row">
|
||||
<main class="col-md-8">
|
||||
{{ content|raw }}
|
||||
</main>
|
||||
<aside class="col-md-4">
|
||||
{{ sidebar_content|raw }}
|
||||
</aside>
|
||||
</div>
|
||||
{% endblock %}
|
||||
```
|
||||
|
||||
Als een pagina geen plugins heeft of de layout geen sidebar bevat, is `sidebar_content` leeg.
|
||||
|
||||
## Guide layout
|
||||
|
||||
De `guide` layout (`guide.twig`) is speciaal voor handleidingen. Het injecteert de Navigation plugin in de sidebar voor zijbalk navigatie. Wordt automatisch gebruikt voor pagina's in de `guide/` map.
|
||||
@@ -2,20 +2,49 @@
|
||||
|
||||
```
|
||||
themes/mijn-thema/
|
||||
├── theme.json # Thema configuratie
|
||||
├── base.twig # Hoofd layout
|
||||
├── full_content.twig # Layout: full-width
|
||||
├── theme.json # { title, config.default_template, template: layout→.twig }
|
||||
├── base.twig # Hoofd layout (head, header, nav, breadcrumb, footer)
|
||||
├── full_content.twig # Layout: volledige breedte
|
||||
├── left_sidebar.twig # Layout: sidebar links
|
||||
├── right_sidebar.twig # Layout: sidebar rechts
|
||||
├── custom.twig # Layout: custom
|
||||
├── custom1.twig # Layout: custom
|
||||
├── guide.twig # Layout: handleiding met sidebar (Navigation plugin)
|
||||
├── partials/
|
||||
│ ├── header.twig
|
||||
│ ├── navigation.twig
|
||||
│ └── footer.twig
|
||||
└── assets/
|
||||
├── scss/theme.scss # SCSS bron
|
||||
├── css/ # CSS bestanden
|
||||
├── js/theme.js # JavaScript
|
||||
├── fonts/ # Lettertypes
|
||||
└── img/ # Afbeeldingen
|
||||
├── scss/theme.scss # SCSS bron (de enige CSS bron)
|
||||
├── css_compiled/ # Gegenereerd door scssphp (read-only, niet handmatig aanpassen)
|
||||
├── css/ # Externe CSS (bootstrap.min.css, bootstrap-icons.css, mobile.css)
|
||||
├── js/ # app.js, bootstrap.bundle.min.js
|
||||
├── fonts/ # bootstrap-icons.woff, woff2
|
||||
└── img/ # favicon, icon, world-map
|
||||
```
|
||||
|
||||
## SCSS is de enige CSS bron
|
||||
|
||||
- **ALTIJD** `assets/scss/theme.scss` aanpassen — dit is de enige CSS bron
|
||||
- `ThemeManager` compileert SCSS runtime naar `assets/css_compiled/theme.css` via scssphp
|
||||
- `assets/css_compiled/` is **read-only** — niet handmatig aanpassen
|
||||
- **NOOIT** `assets/css/theme.css` handmatig aanmaken of aanpassen; dit bestand mag niet bestaan
|
||||
- `ThemeManager::getCssUrl()` prioriteit: 1) `assets/css/theme.css` (handmatig), 2) `assets/css_compiled/theme.css` (gecompileerd). Als `theme.css` bestaat, wordt de SCSS negeren.
|
||||
- Na SCSS wijzigingen: verwijder `assets/css_compiled/theme.css` en `.mtime` om te forceren
|
||||
|
||||
```bash
|
||||
rm themes/mijn-thema/assets/css_compiled/theme.css themes/mijn-thema/assets/css_compiled/.mtime
|
||||
```
|
||||
|
||||
## guide.twig
|
||||
|
||||
Speciale layout voor handleidingen. Injecteert de Navigation plugin in de sidebar voor zijbalk navigatie. Wordt automatisch gebruikt voor pagina's in de `guide/` map.
|
||||
|
||||
## Plugin CSS laden
|
||||
|
||||
Plugin CSS wordt automatisch geladen ná theme CSS in `base.twig`, zodat thema's plugin styling kunnen overschrijven:
|
||||
|
||||
```twig
|
||||
{% for cssUrl in plugin_css_urls|default([]) %}
|
||||
<link href="{{ cssUrl }}" rel="stylesheet">
|
||||
{% endfor %}
|
||||
```
|
||||
@@ -2,20 +2,45 @@
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "Mijn Thema",
|
||||
"default_layout": "full_content",
|
||||
"header_color": "#0a369d",
|
||||
"layouts": {
|
||||
"full_content": "full_content.twig",
|
||||
"left_sidebar": "left_sidebar.twig",
|
||||
"right_sidebar": "right_sidebar.twig"
|
||||
}
|
||||
"title": "Mijn Thema",
|
||||
"config": {
|
||||
"default_template": "full_content"
|
||||
},
|
||||
"template": {
|
||||
"full_content": "full_content.twig",
|
||||
"left_sidebar": "left_sidebar.twig",
|
||||
"right_sidebar": "right_sidebar.twig",
|
||||
"custom1": "custom1.twig",
|
||||
"guide": "guide.twig"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Velden
|
||||
|
||||
- `title` - Weergavenaam in admin
|
||||
- `default_layout` - Standaard layout voor nieuwe pagina's
|
||||
- `header_color` - Kleur admin sidebar
|
||||
- `layouts` - Mapping van layout namen naar .twig bestanden
|
||||
- `title` — Weergavenaam in admin
|
||||
- `config.default_template` — Standaard layout voor pagina's zonder `layout:` frontmatter (fallback bij onbekende layouts)
|
||||
- `template` — Mapping van layout naam naar `.twig` bestand
|
||||
|
||||
## Template mapping
|
||||
|
||||
De `template` mapping definieert welke layouts beschikbaar zijn. Elke key is een layout naam, elke value is het `.twig` bestand:
|
||||
|
||||
| Layout naam | Twig bestand | Beschrijving |
|
||||
|-------------|--------------|--------------|
|
||||
| `full_content` | `full_content.twig` | Volledige breedte, geen sidebar |
|
||||
| `left_sidebar` | `left_sidebar.twig` | Sidebar links |
|
||||
| `right_sidebar` | `right_sidebar.twig` | Sidebar rechts |
|
||||
| `custom1` | `custom1.twig` | Custom layout |
|
||||
| `guide` | `guide.twig` | Handleiding met sidebar (Navigation plugin) |
|
||||
|
||||
## Layout keuze
|
||||
|
||||
- Layouts worden gekozen via frontmatter `layout:` key in content bestanden
|
||||
- Onbekende layouts vallen terug op `config.default_template`
|
||||
- `ThemeManager::getTemplates()` geeft de template mapping terug
|
||||
- `ThemeManager::getConfig()` geeft de config sectie terug (inclusief `default_template`)
|
||||
|
||||
## Guide layout
|
||||
|
||||
De `guide` layout is speciaal voor handleidingen. `getGuidePage()` in `CodePressCMS.php` injecteert automatisch de Navigation plugin in de metadata voor zijbalk navigatie.
|
||||
Reference in New Issue
Block a user