The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Response SimpleTemplate - Simple templating view plugin

SYNOPSIS

        my $response = $mungo->getResponse();
        $response->setTemplateVar("hello", $something);

DESCRIPTION

This view plugin allows you to read a template file and replace placholders with scalar variables.

With this class you can specify empty Mungo actions to just display a static page.

METHODS

setTemplate($template)

        $response->setTemplate("login");

Manually set the template to display.

An file extension of '.html' will be automatically appended to this name.

The template will be fetched from the template directory, See the Notes section for more details.

If an undefined template is given a default will be assumed, which is the default action.

display()

        $response->display();

This method is called automatically at the end of an action.

A template is automatically chosen. An example demonstrates how this is done.

URL used: /foo/bar/app.cgi?action=login Template chosen: app-login.html

setTemplateVar($name, $value)

        $response->setTemplatevar("name", "Bob");

Creates a template variable with the specified name and value.

Notes

If an error occurs a template called "genericerror.html" will be used instead of the specified template. Please make sure you have this file, there is an example of this in the "root/templates" directory of this module.

To change the template location use the following code at the top of your script:

        $CGI::Mungo::Response::SimpleTemplate::templateLoc = "../root";

Author

MacGyveR <dumb@cpan.org>

Development questions, bug reports, and patches are welcome to the above address

Copyright

Copyright (c) 2011 MacGyveR. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.