[% GET variable %] # 'GET' keyword is optional [% variable %] [% hash.key %] [% list.n %] [% code(args) %] [% obj.meth(args) %] [% "value: $var" %]
[% SET variable = value %] # 'SET' also optional [% variable = other_variable variable = 'literal text @ $100' variable = "interpolated text: $var" list = [ val, val, val, val, ... ] list = [ val..val ] hash = { var => val, var => val, ... } %]
[% DEFAULT variable = value %]
[% INSERT legalese.txt %]
[% INCLUDE template %] [% INCLUDE template var = val, ... %]
[% PROCESS template %] [% PROCESS template var = val, ... %]
[% WRAPPER template %] content... [% END %]
[% BLOCK template %] content [% END %]
[% FOREACH variable = [ val, val, val ] %] # either [% FOREACH variable = list %] # or [% FOREACH list %] # or content... [% variable %] [% END %]
[% WHILE condition %] content [% END %]
[% IF condition %] content [% ELSIF condition %] content [% ELSE %] content [% END %] [% UNLESS condition %] content [% # ELSIF/ELSE as per IF, above %] content [% END %]
[% SWITCH variable %] [% CASE val1 %] content [% CASE [ val2, val3 ] %] content [% CASE %] # or [% CASE DEFAULT %] content [% END %]
[% MACRO name <directive> %] [% MACRO name(arg1, arg2) <directive> %] ... [% name %] [% name(val1, val2) %] * **FILTER** - Process enclosed FILTER ... END block then pipe through a filter. [% FILTER name %] # either [% FILTER name( params ) %] # or [% FILTER alias = name( params ) %] # or content [% END %]
[% USE name %] # either [% USE name( params ) %] # or [% USE var = name( params ) %] # or ... [% name.method %] [% var.method %]
[% TRY %] content [% THROW type info %] [% CATCH type %] catch content [% error.type %] [% error.info %] [% CATCH %] # or [% CATCH DEFAULT %] content [% FINAL %] this block is always processed [% END %]
[% NEXT %]
[% LAST %]
[% RETURN %]
[% STOP %]
[% TAGS html %] [% TAGS <!-- --> %]
[% # this is a comment to the end of line foo = 'bar' %] [%# placing the '#' immediately inside the directive tag comments out the entire directive %]