How to Create Views

Tutorial: Creating Custom Views

Frontend views are decoupled PHP templates. They can reside under src/Views/themes/[theme_name]/ or decoupled inside module structures src/Modules/[ModuleName]/Views/.

<!-- src/Views/themes/default/home.php -->
<h2><?php echo htmlspecialchars($title); ?></h2>
<p><?php echo $description; ?></p>

Dynamic Theme Fallbacks & Cascading Path Resolution

When rendering templates via App::render($view, $data), the template engine employs an intelligent cascading resolution pattern. It checks the active site's selected theme configuration (e.g. "guide"). The resolver first attempts to load templates from the child theme: src/Views/themes/{activeTheme}/{view}.php. If that file is missing on disk, it gracefully and silently falls back to src/Views/themes/default/{view}.php—ensuring the application never triggers compilation or crash errors while enabling rapid, non-destructive child theme customisations!

Double-Buffered Layout Nesting

To render templates cleanly within unified headers, sidebars, and footer wrappers without code repetition, the template engine uses output buffering (ob_start() and ob_get_clean()) to isolate execution and capture the sub-view output, dynamically injecting it as $content inside the active theme's layout.php master wrapper.