Templates and Views

The documentation is constantly evolving and updated alongside the project's progress. Since it is developed in parallel with the code, some sections may temporarily refer to earlier versions of the system-these are gradually adapted to the current state of the application. If you notice any outdated information, please report it or open an Issue / Pull Request.

Documentation

# Templates and Views

The Dbm\Views module compiles and renders templates and provides runtime features for web controllers. BaseController is the usual entry point for rendering HTML.

# Render a template

return $this->render('article/show.phtml', [
    'article' => $article,
]);

Template paths are resolved by the configured view service. Confirm the application's template root and compiler settings in its bootstrap.

# Components

  • TemplateEngine coordinates rendering.
  • TemplateCompiler compiles supported template syntax.
  • TemplateRuntime and TemplateFeature provide runtime helpers.
  • TemplateCache caches compiled artifacts according to configuration.
  • ViewExtension and FilterExtension register template features.
  • FlashBag stores one-time messages through SessionManager.
  • ViewServiceProvider registers view services.

The application may add global values or extensions during composition. Do not assume application-specific template helpers exist in every framework consumer.

# Flash messages and output safety

Inject FlashBag and set a message for later display. Flash behavior requires the session to be available and started by the request pipeline.

Escape untrusted values for the output context. Template compilation does not replace authorization, input validation, or context-appropriate output escaping.