Skip to content

Views

A view turns data from a controller into HTML. Almasix’s view engine is Prism: templates under resources/views with a .prism.html extension, compiled to Python and cached in the process. This page is the overview; the full Prism tutorial lives under Prism.

app/http/controllers/welcome_controller.py
from almasix.prism import view
async def index(self):
return view("welcome", {"title": "Almasix"})

Templates live under resources/views. Dots map to directories: view("posts.show")resources/views/posts/show.prism.html.

resources/views/welcome.prism.html
@extends("layouts.app")
@section("content")
<h1>{{ title }}</h1>
@endsection

The second argument to view() is a dict of template data. Helpers such as url, asset, e, and __ are injected automatically for Prism templates.

Syntax Meaning
{{ value }} HTML-escaped (safe default)
{!! value !!} Raw HTML — only when you trust the content

html() is for small hand-built fragments or low-level responses. Prefer view() for pages, layouts, and components.