The View

Views are the presentation layer of Chaos MVC. They receive data prepared by a controller and turn that data into the response shown to the user.

Responsibilities

  • Render HTML and other presentation output.
  • Display values supplied through the view data array.
  • Escape user-controlled values before output.
  • Use shared layouts and theme includes for consistent presentation.

Views Do Not Contain Application Logic

Database queries and business decisions belong in models and controllers. A view may use simple presentation conditions and loops, but it must not retrieve or modify application data.

Controller
    prepares data
        ↓
View
    presents data
        ↓
HTML response

Rendering a Module View

$data = [
    'title' => 'Example Page',
    'items' => $items,
];

$this->view('example', $data);

Module views belong directly in the module's views/ directory. Keeping the structure flat makes each page easy to locate and keeps view names consistent with controller calls.