web template
This block is part of the web group and was last modified in core v15.0.1.
web template v15.0.1 Renders a template to a piece of HTML: a section of a page, or the new version of one row for web replace. Custom pins become template variables.
- template
valueThe template (HTML with {{mustache}});
{{> name}}renders a stored web template. - data
object - key
valueGives the fragment's root element this data-key.
- html
value - success
condition - error
value
Data block (no flow pins): renders `template` (or the block's stored `html` field) with the same engine and variables as web_render (data fields, custom pins by id, `web`), and outputs html. With `key` the fragment's first element gets data-key="<key>" (kept if it already has one; plain text is wrapped in a <div>), which is what web_replace/web_remove address. Typical action answer: storage update -> web_template(template: "{{> order-row}}", data: the updated document, key: its guid) -> web_replace(key, html). An empty template renders "" with success=true; a template error outputs html="", success=false and the message on error.
html fragment |
partial |
render row |
web template renders a template to a piece of HTML: a section of a page, or the new version of one row. It has no flow pins and runs when something reads its html. Here the fields of the posted form become template variables, so {{message}} is escaped for its place in the markup. That is why text a visitor typed goes through it on the way to web update, whose html pin takes HTML as it is. With the key pin the fragment's first element gets that data-key, which keeps a rendered row reachable for later actions. A template error gives an empty html, turns success off and puts the message on error.
Used in these guides
These documentation pages use or explain this block:
- Building a Dashboard with Charts
- Building a Login Page
- Email System Setup
- File Upload & Processing
- Escaping and Security
- Layouts and Partials
- Template Syntax
- Web Actions
Version history
Introduced in v15.0.1.
v15.0.1: block added in this release.
Back to
web Return to the main group to view all sub-groups Back to web templates Return to the group to view all blocks within this group 