Djot View Demo

This page is rendered directly from a .djot file using DjotView.

How It Works

Instead of writing PHP templates, you write content in Djot markup. The view class automatically converts it to HTML.

Variable Substitution

View variables can be inserted using {{varName}} syntax. For example, the title above uses Djot View Demo.

Features

Djot-PHP provides:

  • Fast parsing with the PHP-Collective parser
  • Safe mode for XSS protection
  • Profile support for feature restriction

Example Controller

public function documentation(): void
{
    $this->viewBuilder()->setClassName('Markup.Djot');
    $this->set('title', 'My Documentation');
}

When to Use DjotView

This approach works well for:

  1. Documentation pages
  2. Static content that rarely changes
  3. Content managed by non-developers
  4. Markdown/Djot migration projects

DjotView is ideal for content-heavy pages where the markup is the primary content, not dynamic data rendering.


Back to Djot Helper examples | Back to Markup overview

</div>