Response TemplateToolkit - View plugin using template toolkit
my $response = $mungo->getResponse(); $response->setTemplateVar("hello", $something);
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.
Constructor, All environment hash is saved in template variable "env" and the current action is saved as "action" so they can be accessed along with any other variables stored during the server action in the usual template toolkit way.
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.
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
$response->setError("something has broken");
Set an error message for the response, which is accessible in the error template as [% message %].
Creates a template variable with the specified name and value. The variable may be of any type and can be access from the template in the usual way.
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";
Development questions, bug reports, and patches are welcome to the above address
Copyright (c) 2012 MacGyveR. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.