HTML::Template::Filter::TT2 - Template Toolkit 2 syntax for HTML::Template


NAME

HTML::Template::Filter::TT2 - Template Toolkit 2 syntax for HTML::Template


VERSION

Version 0.03


SYNOPSIS

    use HTML::Template::Filter::TT2;
    my $tmpl = HTML::Template->new(filter => \&ht_tt2_filter, ...);


DESCRIPTION

This HTML::Template filter allows you to use a subset of the Template Toolkit 2 syntax, which is much less verbose than the default syntax. This is not an emulation of TT2, so you're still limited to the usual HTML::Template semantics. Also, in order to keep the filter fast and simple, the [% end %] must be written with the block name. See below for details.


SYNTAX

Here is the syntax recognised by this module.

Variables

Simple interpolation:

    [% variable %]

Interpolation with default value:

    [% variable :default %]

Interpolation with filter (i.e. a HTML::Template escape mode):

    [% variable |filter %]

Interpolation with default value and filter:

    [% variable :default |filter %]

If statements

    [% if condition %] ... [% else %] ... [end_if %]

The difference with the actual TT2 syntax is that you must use end_if instead of end

Loops

    [% loop loop-name %] ... [% end_loop %]

As for the if statement, you must use end_loop instead of end.


EXPORT

Exports the ht_tt2_filter function by default.


FUNCTIONS

ht_tt2_filter()

Pass a reference to this function to the filter parameter when calling HTML::Template->new()


AUTHOR

Sébastien Aperghis-Tramoni, <sebastien at aperghis.net>

SEE ALSO

the HTML::Template manpage, the Template::Toolkit manpage


BUGS

Please report any bugs or feature requests to bug-html-template-filter-tt2 at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.


SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc HTML::Template::Filter::TT2

You can also look for information at:


COPYRIGHT & LICENSE

Copyright 2007 Sébastien Aperghis-Tramoni, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.