A quick reference for html::template::compiled syntax
<TMPL_IF var><TMPL_VAR foo></tmpl_if var> <!-- TMPL_IF var --><!-- TMPL_VAR foo --><!-- /tmpl_if var --> <%if var %><%= foo %><%/if var %>
Optional tagstyle 'tt':
[%if var %][%= foo %][%/if var %]
<%= _.foo %> outputs foo in the cuurent position of the stash and is the same as <%= foo %>
<%= .config.url %> goes to root of parameter stash; like $params->{config}->{url}
<%= ..foo %> goes one level up in stash
<%= list[3].keyname.method %> acts like: $stash->[3]->{keyname}->method
<%var foo%> or <%= foo%>
conditions like in Perl
for-loop and while-loop like in Perl. <%loop cds%><%= _\|_counter_\|_%>. Title: <%= _.title%><%/loop cds%> <%loop cds join=", " %><%= _.title%><%/loop cds%> <%while resultset.next%><%= _\|_counter_\|_%>. <%= _.foo %><%/while %> <%each hashref%><%= _\|_key_\|_ %>=<%= _\|_value_\|_ %><%/each %> (sorted alphanumeric) <%each hashref sort=alpha %><%= _\|_key_\|_ %>=<%= _\|_value_\|_ %><%/each %> (sorted alphanumeric) <%each hashref sort=num %><%= _\|_key_\|_ %>=<%= _\|_value_\|_ %><%/each %> (sorted numeric) <%each hashref sort=0 %><%= _\|_key_\|_ %>=<%= _\|_value_\|_ %><%/each %> (not sorted)
<%with cds[0].artist.fanclub%><%= _.address%><%= _.homepage%><%/with %>
<%include template.htc%> <%include_var param_with_template_name%>
<%comment explanation %> This will not appear in the rendered template. blah blah... <%/comment explanation %>
<%switch .config.language%> <%case de%>Hallo <%case es%>Hola <%case en,default%>Hello <%/switch .config.language%>
See section Perl in HTML::Template::Compiled
Each attribute can be written as
attribute=foo attribute="some thing" attribute='some "thing"'
You can omit the 'name=' here. <%if var%>var<%elsif name=var2%>var4<%/if%> Can be used in all tags.
<%= message escape=html %> <%= params escape=url %> <%= params escape=js %> <%= some_var escape=dump|html%> Can be used in \*(C`VAR\*(C'-tags.
<%= this.var.might_be_undef default="my fault" %> Can be used in \*(C`VAR\*(C'-tags.
<%loop cds alias="cd" %><%= $cd.title %><%/loop cds %> Can be used in \*(C`LOOP\*(C' and \*(C`WHILE\*(C'. Works like \*(L"\s-1SET_VAR\s0\*(R" and is short for <%loop cds %><%set_var cd value=_ %><%= cd.title %><%/loop cds %> Useful for nested loops.
<%set_var myvar value=.another.var %> <%set_var myvar2 expr="60 * 60 * 24" %> This creates a variable similar to a package var with local() in perl.
<!-- recognize myvar and myvar2 as variables not parameter stash --> <%use_vars myvar,myvar2 %> myvar: <%= myvar %>
<%loop cds join=", " %><%= _.title%><%/loop cds%> can be used in \*(C`LOOP\*(C'
<%loop cds break="3" %> <%= _.title%><%if _\|_break_\|_ %>\n</%if %> <%/loop cds%> Sets \*(C`_\|_break_\|_\*(C' to 1 every xth loop. Can be used in \*(C`LOOP\*(C', \*(C`WHILE\*(C' and \*(C`EACH\*(C'
<%= _\|_index_\|_ %> the current loop index starting at 0 <%= _\|_counter_\|_ %> the current loop index starting at 1 <%= _\|_first_\|_ %> true if first iteration <%= _\|_last_\|_ %> true if last iteration <%= _\|_odd_\|_ %> true if _\|_counter_\|_ is odd <%= _\|_inner_\|_ %> true if not last or first iteration <%= _\|_key_\|_ %> the key of an EACH iteration <%= _\|_value_\|_ %> the value of an EACH iteration <%= _\|_break_\|_ %> see L<"BREAK"> above <%= _\|_filename_\|_ %> filename of current template (since 0.91_001) <%= _\|_filenameshort_\|_ %> short filename of current template (since 0.91_001)