Concept mapping
Fluid and Handlebars share the same goal — separating presentation from logic — but take different philosophical stances on how much the template language itself should do. Understanding this difference up front makes the rest of the migration straightforward.
The logic-less philosophy
Fluid templates can contain complex expressions: inline ViewHelper chaining, boolean operators, type-coercing comparisons, and dynamic dispatch to arbitrary PHP classes. This power comes at the cost of templates that are hard to read outside of a PHP context.
Handlebars is explicitly "logic-less". Templates may only output values, iterate over arrays, and branch on truthiness. All other logic must live in a named helper — a PHP callable registered with the renderer. This constraint keeps templates readable by designers and front-end developers who do not know PHP, and it shifts complexity to a layer that can be unit-tested cleanly.
Concept-by-concept mapping
The table below maps every major Fluid concept to its Handlebars equivalent. Detailed examples for each row are given in the linked pages.
| Fluid | Handlebars | See |
|---|---|---|
{variable} | { (HTML-escaped) | Template syntax |
{variable -> f: | { (triple-stash, raw) | Template syntax |
<f:, <f: | {, {, { | Template syntax |
<f: | {, {, @index | Template syntax |
<f: | { | Template syntax |
<f: | { | Template syntax |
<f: | { | Layouts and partials |
<f: (in layout) | { | Layouts and partials |
<f: (in template) | { | Layouts and partials |
| ViewHelper class | Helper callable +
# attribute | Helpers |
<f: | Custom
translate helper | Helpers |
<f: | Custom
format helper | Helpers |
Variables from controller
assign | TypoScript
variables block | Gradual migration |
plugin. |
plugin. | Template paths |
See also
Handlebars Language Guide to explore more available language features.
Things Handlebars does not have
Some Fluid features have no direct equivalent and require a different approach:
- Inline ViewHelper chains
- Fluid allows
{value -> f:. In Handlebars, compose the same logic in a single helper that applies both transformations.format. trim () -> f: format. upper ()} - Arithmetic and boolean operators in templates
- Fluid supports
{a + b}and{a && b}in some contexts. In Handlebars, compute the result in a data processor or a helper and expose it as a plain variable. - Type-aware comparisons
<f:works in Fluid because it parses the expression. Handlebarsif condition=" {count} > 0"> {only tests truthiness —{#if count}} 0and the empty string are falsy, everything else is truthy. Write a helper if you need a numeric comparison.- Named format strings in the template
- Fluid's
<f:ViewHelpers apply a PHP function to a value. Replace each one with a small helper whose name describes the transformation (e.g.,format.*> {).{format Date date format="d. m. Y"}}
Note
The extension ships a view bridge helper that lets you
call any registered Fluid ViewHelper from a Handlebars template without
writing a wrapper. This is intended as a temporary aid during migration;
see Fluid ViewHelper bridge for details.