{* This is a comment *}

Test Rain Tpl {$version}


Variables

Variable: {$variable}

Init Variable {$v = 10}

Show Variable {$v}

Modifier {$variable|strlen}

Cascade Modifier {$variable|substr:2,5|strlen}

Scoping (object) {$user->name}

Scoping (array) {$week.0}

Variable as key {$week[$numbers.0]}

Var test {$variable}

Ternary Operator

The title is: {isset($title)?"$title":'default title'}

Loop

Simple Loop

Modifier on Loop

Simple Nested Loop

Loop on created array

If

True condition: {if="true"}This is true{/if}

Modifier inside if: {if="$variable|is_string"}True{/if}

Function test

Simple function: {function="time"}

Function with parameters: {function="date('d-m-Y')"}

Static method: {function="Test::method('123test')"}

Escape Text

Malicious content: {$bad_text}

Custom tag

{@message to translate@}

Custom tag 2

{%message to translate|english%}

Escape variable

{$bad_variable} {autoescape="off"}{$safe_variable}{/autoescape}