CGI::FastTemplate 1.09 review
Download
|
|
CGI::FastTemplate is a Perl extension for managing templates, and performing variable interpolation.
SYNOPSIS
use CGI::FastTemplate;
$tpl = new CGI::FastTemplate();
$tpl = new CGI::FastTemplate("/path/to/templates");
CGI::FastTemplate->set_root("/path/to/templates"); ## all instances will use this path
$tpl->set_root("/path/to/templates"); ## this instance will use this path
$tpl->define( main => "main.tpl",
row => "table_row.tpl",
all => "table_all.tpl",
);
$tpl->assign(TITLE => "I am the title.");
my %defaults = ( FONT => "",
EMAIL => 'jmoore@sober.com',
);
$tpl->assign(%defaults);
$tpl->parse(ROWS => ".row"); ## the '.' appends to ROWS
$tpl->parse(CONTENT => ["row", "all"]);
$tpl->parse(CONTENT => "main");
$tpl->print(); ## defaults to last parsed
$tpl->print("CONTENT"); ## same as print() as "CONTENT" was last parsed
$ref = $tpl->fetch("CONTENT");
Requirements:
Perl
CGI::FastTemplate 1.09 search tags