NAME
Helix::Driver::Template::Generic - Helix Framework generic template driver.
SYNOPSIS
Example template driver:
package Helix::Driver::Template::Example;
use base qw/Helix::Driver::Template::Generic/;
use constant DRIVER_TYPE => DT_TEMPLATE_EXAMPLE;
sub parse
{
my ($self, $tpl) = @_;
throw Error::Driver::Template::Open("This is just an example!");
}
sub render
{
my $self = shift;
throw Error::Driver::Template::Open("This is just an example!");
}
DESCRIPTION
The Helix::Driver::Template::Generic is a generic template driver for Helix Framework. It declares some functions that are common for all driver types and some abstract methods, that must be overloaded in ancestor classes. All template drivers should subclass this package.
Driver type: DT_TEMPLATE
.
METHODS
new($templates_dir)
Class constructor. Sets initial class data: $templates_dir
- directory where template file will be placed, and checks if $template_dir
directory exists, and if it doesn't - throws an exception.
set(%vars)
Sets template variables. %vars
- hash of variables and corresponding values. For example:
(
"title" => "Hello, world!",
"content" => "Blabla"
)
parse($tpl)
Parses a $tpl
template. Abstract method, should be overloaded in ancestor class.
render()
Renders a previously parsed template. Abstract method, should be overloaded in ancestor class.
SEE ALSO
Helix, Helix::Driver::Template::Exceptions
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
Anton Belousov, <abel@cpan.org>
COPYRIGHT
Copyright (c) 2009, Atma 7, http://www.atma7.com