NAME
App::TemplateEngine - Interface for rendering HTML templates
SYNOPSIS
use App;
$context = App->context();
$template_engine = $context->service("TemplateEngine"); # or ...
$template_engine = $context->template_engine();
$template = "index.html";
$text = $template_engine->render($template);
DESCRIPTION
A TemplateEngine Service is a means by which a template (such as an HTML template) may be rendered (with variables interpolated).
Class Group: TemplateEngine
The following classes might be a part of the TemplateEngine Class Group.
Class: App::TemplateEngine
Class: App::TemplateEngine::TemplateToolkit
Class: App::TemplateEngine::Embperl
Class: App::TemplateEngine::Mason
Class: App::TemplateEngine::AxKit
Class: App::TemplateEngine::ASP
Class: App::TemplateEngine::CGIFastTemplate
Class: App::TemplateEngine::TextTemplate
Class: App::TemplateEngine::HTMLTemplate
Class: App::TemplateEngine
A TemplateEngine Service is a means by which a template (such as an HTML template) may be rendered (with variables interpolated).
* Throws: App::Exception::TemplateEngine
* Since: 0.01
Class Design
...
Constructor Methods:
new()
The constructor is inherited from App::Service
.
Public Methods:
render()
* Signature: $text = $template_engine->render($template);
* Param: $template string
* Return: $text text
* Throws: App::Exception::TemplateEngine
* Since: 0.01
Sample Usage:
$text = $template_engine->render($template);
Protected Methods:
service_type()
Returns 'TemplateEngine';
* Signature: $service_type = App::TemplateEngine->service_type();
* Param: void
* Return: $service_type string
* Since: 0.01
$service_type = $template_engine->service_type();
read_template()
* Signature: $template_text = $template_engine->read_template($template);
* Param: $template string
* Return: $template_text text
* Throws: App::Exception::TemplateEngine
* Since: 0.01
Sample Usage:
$template_text = $template_engine->read_template($template);
prepare_values()
* Signature: $values = $template_engine->prepare_values();
* Param: void
* Return: $values {}
* Throws: App::Exception::TemplateEngine
* Since: 0.01
Sample Usage:
$values = $template_engine->prepare_values();
substitute()
* Signature: $text = $template_engine->substitute($template_text, $values);
* Param: $template_text string
* Param: $values {}
* Return: $text text
* Throws: App::Exception::TemplateEngine
* Since: 0.01
Sample Usage:
$text = $template_engine->substitute($template_text, $values);
ACKNOWLEDGEMENTS
* Author: Stephen Adkins <stephen.adkins@officevision.com>
* License: This is free software. It is licensed under the same terms as Perl itself.