Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
directive_summary [2012-08-01 11:30] – created randerson | directive_summary [2013-12-06 14:12] (current) – Fix heading level rspencer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Directive Summary===== | + | ====== Directive Summary ====== |
- | * GET - Evaluate and print a variable or value.< | + | |
+ | | ||
[% GET variable %] # ' | [% GET variable %] # ' | ||
Line 9: | Line 10: | ||
[% obj.meth(args) %] | [% obj.meth(args) %] | ||
[% " | [% " | ||
- | * SET - Assign a values to variables.< | + | |
[% SET variable = value %] # ' | [% SET variable = value %] # ' | ||
Line 19: | Line 20: | ||
hash = { var => val, var => val, ... } | hash = { var => val, var => val, ... } | ||
%]</ | %]</ | ||
- | * DEFAULT - Like SET above, but variables are only set if currently unset (i.e. have no true value).< | + | |
[% DEFAULT variable = value %]</ | [% DEFAULT variable = value %]</ | ||
- | * INSERT - Insert a file without any processing performed on the contents.< | + | |
[% INSERT legalese.txt %]</ | [% INSERT legalese.txt %]</ | ||
- | * INCLUDE - Process another template file or block and include the output. | + | |
[% INCLUDE template %] | [% INCLUDE template %] | ||
[% INCLUDE template | [% INCLUDE template | ||
- | * PROCESS - As INCLUDE above, but without localising variables.< | + | |
[% PROCESS template %] | [% PROCESS template %] | ||
[% PROCESS template | [% PROCESS template | ||
- | * WRAPPER - Process the enclosed block WRAPPER ... END block then INCLUDE the named template, passing the block output in the ' | + | |
[% WRAPPER template %] | [% WRAPPER template %] | ||
content... | content... | ||
[% END %]</ | [% END %]</ | ||
- | * BLOCK - Define a named template block for subsequent INCLUDE, PROCESS, etc.,< | + | |
[% BLOCK template %] | [% BLOCK template %] | ||
content | content | ||
[% END %]</ | [% END %]</ | ||
- | * FOREACH - Repeat the enclosed FOREACH ... END block for each value in the list.< | + | |
[% FOREACH variable = [ val, val, val ] %] # either | [% FOREACH variable = [ val, val, val ] %] # either | ||
[% FOREACH variable = list %] # or | [% FOREACH variable = list %] # or | ||
Line 44: | Line 45: | ||
[% variable %] | [% variable %] | ||
[% END %]</ | [% END %]</ | ||
- | * WHILE - Enclosed WHILE ... END block is processed while condition is true.< | + | |
[% WHILE condition %] | [% WHILE condition %] | ||
content | content | ||
[% END %]</ | [% END %]</ | ||
- | * IF / UNLESS / ELSIF / ELSE - Enclosed block is processed if the condition is true / false.< | + | |
[% IF condition %] | [% IF condition %] | ||
content | content | ||
Line 61: | Line 62: | ||
content | content | ||
[% END %]</ | [% END %]</ | ||
- | * SWITCH / CASE - Multi-way switch/case statement.< | + | |
[% SWITCH variable %] | [% SWITCH variable %] | ||
[% CASE val1 %] | [% CASE val1 %] | ||
Line 70: | Line 71: | ||
content | content | ||
[% END %]</ | [% END %]</ | ||
- | * MACRO - Define a named macro.< | + | |
[% MACRO name < | [% MACRO name < | ||
[% MACRO name(arg1, arg2) < | [% MACRO name(arg1, arg2) < | ||
Line 76: | Line 77: | ||
[% name %] | [% name %] | ||
[% name(val1, val2) %] | [% name(val1, val2) %] | ||
- | * FILTER - Process enclosed FILTER ... END block then pipe through a filter. | + | |
[% FILTER name %] # either | [% FILTER name %] # either | ||
[% FILTER name( params ) %] # or | [% FILTER name( params ) %] # or | ||
Line 82: | Line 83: | ||
content | content | ||
[% END %]</ | [% END %]</ | ||
- | * USE Load a " | + | |
[% USE name %] # either | [% USE name %] # either | ||
[% USE name( params ) %] # or | [% USE name( params ) %] # or | ||
Line 89: | Line 90: | ||
[% name.method %] | [% name.method %] | ||
[% var.method %]</ | [% var.method %]</ | ||
- | * TRY / THROW / CATCH / FINAL - Exception handling.< | + | |
[% TRY %] | [% TRY %] | ||
content | content | ||
Line 101: | Line 102: | ||
this block is always processed | this block is always processed | ||
[% END %]</ | [% END %]</ | ||
- | * NEXT - Jump straight to the next item in a FOREACH/ | + | |
[% NEXT %]</ | [% NEXT %]</ | ||
- | * LAST - Break out of FOREACH/ | + | |
[% LAST %]</ | [% LAST %]</ | ||
- | * RETURN - Stop processing current template and return to including templates.< | + | |
[% RETURN %]</ | [% RETURN %]</ | ||
- | * STOP - Stop processing all templates and return to caller.< | + | |
[% STOP %]</ | [% STOP %]</ | ||
- | * TAGS - Define new tag style or characters (default: [% %]).< | + | |
[% TAGS html %] | [% TAGS html %] | ||
[% TAGS <!-- --> %]</ | [% TAGS <!-- --> %]</ | ||
- | * COMMENTS - Ignored and deleted.< | + | |
[% # this is a comment to the end of line | [% # this is a comment to the end of line | ||
foo = ' | foo = ' |