TAGSTYLES

    <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 %]

ACCESSING VARIABLES

<%= _.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

TAGS

\s-1VAR\s0

<%var foo%> or <%= foo%>

\s-1IF\s0, \s-1IF_DEFINED\s0, \s-1UNLESS\s0, \s-1ELSIF\s0, \s-1ELSE\s0

conditions like in Perl

\s-1LOOP\s0, \s-1WHILE\s0, \s-1EACH\s0

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)

\s-1WITH\s0

<%with cds[0].artist.fanclub%><%= _.address%><%= _.homepage%><%/with %>

\s-1INCLUDE\s0, \s-1INCLUDE_VAR\s0

<%include template.htc%> <%include_var param_with_template_name%>

\s-1COMMENT\s0, \s-1VERBATIM\s0, \s-1NOPARSE\s0

<%comment explanation %> This will not appear in the rendered template. blah blah... <%/comment explanation %>

\s-1SWITCH\s0, \s-1CASE\s0

<%switch .config.language%> <%case de%>Hallo <%case es%>Hola <%case en,default%>Hello <%/switch .config.language%>

\s-1PERL\s0

See section Perl in HTML::Template::Compiled

ATTRIBUTES

Each attribute can be written as

attribute=foo attribute="some thing" attribute='some "thing"'

\s-1NAME\s0

You can omit the 'name=' here. <%if var%>var<%elsif name=var2%>var4<%/if%> Can be used in all tags.

\s-1ESCAPE\s0

<%= message escape=html %> <%= params escape=url %> <%= params escape=js %> <%= some_var escape=dump|html%> Can be used in \*(C`VAR\*(C'-tags.

\s-1DEFAULT\s0

<%= this.var.might_be_undef default="my fault" %> Can be used in \*(C`VAR\*(C'-tags.

\s-1ALIAS\s0

<%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.

\s-1SET_VAR\s0

<%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.

\s-1USE_VARS\s0

<!-- recognize myvar and myvar2 as variables not parameter stash --> <%use_vars myvar,myvar2 %> myvar: <%= myvar %>

\s-1JOIN\s0

<%loop cds join=", " %><%= _.title%><%/loop cds%> can be used in \*(C`LOOP\*(C'

\s-1BREAK\s0

<%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'

OPTIONS

(loop)_context_vars

<%= _\|_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)