NAME

Dotiac::DTL::Addon::html_template::Replace - Use Dotiac::DTL as HTML::Template

SYNOPSIS

#!/usr/bin/perl -w
use Dotiac::DTL::Addon::html_template::Replace;

# open the html template
my $template = HTML::Template->new(scalarref => \$templatedata);

# fill in some parameters
$template->param(HOME => $ENV{HOME});
$template->param(PATH => $ENV{PATH});

# send the obligatory Content-Type and print the template output
print "Content-Type: text/html\n\n", $template->output;

DESCRIPTION

Makes

Just replace

use HTML::Template;

with use Dotiac::DTL::Addon::html_template::Replace;

or

use Dotiac::DTL::Addon::html_template::Replace qw/combine/;	

in the script that calls that template.

When using file names and a lot of different options to new(), Dotiac::DTL::Addon::html_template::Convert is a better choice.

combine

When set "combine" in the use statement, this module will allow combined Django and HTML::Template code:

Valid template:

{% if test or failed %}<TMPL_VAR test>{% endif %}

This is done by first converting HTML::Template code into Django template code and then parsing the whole thing again.

{% if test or failed %}{{ test }}{% endif %}

The flags will be added with a leading "+" instead of a "-".

What won't work

Some options are accepted (global_vars,filter,loop_context_vars,associate,case_sensitive) the others are ignored (caching).

Sadly, the params() call without arguments and query() won't work at all prior to Dotiac::DTL 0.8, since Dotiac::DTL doesn't really care for variables until it renders.

Compiling

There is one additional option to new():

compile

Instructs Dotiac::DTL to compile the template, only works with filenames

my $t=HTML::Template->new(filename=>"foo.html",compile=>1);

BUGS

Please report any bugs or feature requests to https://sourceforge.net/tracker2/?group_id=249411&atid=1126445

SEE ALSO

Dotiac::DTL, Dotiac::DTL::Addon, http://www.dotiac.com, http://www.djangoproject.com

AUTHOR

Marc-Sebastian Lucksch

perl@marc-s.de