Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 411 Bytes

File metadata and controls

30 lines (21 loc) · 411 Bytes

Basic Native Rendering

Directory structure:

templates/
  pages/
    home.php

Template:

<!-- templates/pages/home.php -->
<h1><?= $e($title) ?></h1>

Render:

use CommonPHP\UI\ViewFactory;

$ui = new ViewFactory(templatePaths: [__DIR__ . '/templates']);

$html = $ui->render('pages.home', [
    'title' => 'Home',
]);

pages.home resolves to templates/pages/home.php.