CandidTemplate
A DOM-based templating engine focused on structure, composition, and clean binding.
---
🚀 Quick Example
$tpl = (new CandidTemplateAdaptor('views'))
->bind('layout.html');
$page = $tpl->slot('content','home');
$page->pick('title')->content('Welcome');
echo $tpl->build()->render();
🧠 1. Template Composition Flow
layout.html
↓
slot('content','admin')
↓
slot('content','dashboard')
↓
Final Render
Build UI layer by layer using nested layouts.
---
🧩 2. Rendering Pipeline
HTML Template
↓
DOM Parsing (CandidDomContext)
↓
Slots + Includes
↓
Loops
↓
Data Binding (pick)
↓
Final HTML
Everything is processed through a structured DOM pipeline.
---
🔁 3. Data Flow
Controller / Data File
↓
Template (set / get / share)
↓
pick() binding
↓
Rendered UI
Clear separation between data and structure.
---
⚡ Key Features
- ✔ Nested layouts (multi-level composition)
- ✔ DOM-based manipulation (no string hacks)
- ✔ Clean binding API (
pick()) - ✔ Loop system for structured repetition
- ✔ Vue-compatible rendering
- ✔ Data files for view logic separation
🎯 Philosophy
Structure → Composition → Binding → Rendering
---
📦 When to Use
- Admin dashboards
- Structured web apps (like your restaurant app)
- Hybrid PHP + Vue applications
🚫 When NOT to Use
- Highly dynamic SPA (use Vue/React fully)
- Heavy real-time UI updates
CandidTemplate is designed for structured rendering, not client-side reactivity.