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.
Creating and returning views
Section titled “Creating and returning views”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.
@extends("layouts.app")
@section("content") <h1>{{ title }}</h1>@endsectionPassing data
Section titled “Passing data”The second argument to view() is a dict of template data. Helpers such as
url, asset, e, and __ are injected automatically for Prism templates.
Escaping
Section titled “Escaping”| Syntax | Meaning |
|---|---|
{{ value }} |
HTML-escaped (safe default) |
{!! value !!} |
Raw HTML — only when you trust the content |
When to use html()
Section titled “When to use html()”html() is for small hand-built fragments or low-level
responses. Prefer view() for pages, layouts, and components.
Deep dive
Section titled “Deep dive”- Prism — overview
- Rendering Views
- Layouts & Inheritance
- Components & Slots
- Control Structures
- Including Subviews
- Stacks & Directives