Core

{{ Brackets }}

Double brackets let you step out of plain HTML for a moment and ask TemplateX to do something.

Most of your view can stay normal HTML. When you need a value, a small expression, or a little browser behavior, you put it inside {{ }}.

Why Brackets#

TemplateX uses {{ }} because they are easy to spot inside markup.

phpresources/views/front-page.php
<main>  <h1>{{ title }}</h1>  {{ content }}</main>

The HTML is still the main thing you read. The brackets mark the parts TemplateX should handle.

A value tag prints once:

php
{{ title }}

That means: print the current title here.

Value tags are not paired tags. They do not need a closing tag.

Use Small Expressions#

Brackets can also hold small expressions:

php
{{ 1 + 1 }}

This prints 2.

You can use this for tiny bits of logic where it keeps the markup readable.