P5EEx-Blue-0.01

P5EEx::Blue::TemplateEngine


NAME

P5EEx::Blue::TemplateEngine - Interface for rendering HTML templates


SYNOPSIS

    use P5EEx::Blue::P5EE;
    $context = P5EEx::Blue::P5EE->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: P5EEx::Blue::TemplateEngine

A TemplateEngine Service is a means by which a template (such as an HTML template) may be rendered (with variables interpolated).

 * Throws: P5EEx::Blue::Exception::TemplateEngine
 * Since:  0.01

Class Design

...


Constructor Methods:

new()

The constructor is inherited from P5EEx::Blue::Service.


Public Methods:

render()

    * Signature: $text = $template_engine->render($template);
    * Param:     $template          string
    * Return:    $text              text
    * Throws:    P5EEx::Blue::Exception::TemplateEngine
    * Since:     0.01
    Sample Usage:
    $text = $template_engine->render($template);


Protected Methods:

service_type()

Returns 'TemplateEngine';

    * Signature: $service_type = P5EEx::Blue::TemplateEngine->service_type();
    * Param:     void
    * Return:    $service_type  string
    * Since:     0.01
    $service_type = $widget->service_type();

read_template()

    * Signature: $template_text = $template_engine->read_template($template);
    * Param:     $template          string
    * Return:    $template_text     text
    * Throws:    P5EEx::Blue::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:    P5EEx::Blue::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:    P5EEx::Blue::Exception::TemplateEngine
    * Since:     0.01
    Sample Usage:
    $text = $template_engine->substitute($template_text, $values);

This method substitutes (No subclass of this class need be used if the


ACKNOWLEDGEMENTS

 * Author:  Stephen Adkins <stephen.adkins@officevision.com>
 * License: This is free software. It is licensed under the same terms as Perl itself.


SEE ALSO

P5EEx::Blue::Context, P5EEx::Blue::Service