- SEE ALSO
- COPYRIGHT AND LICENSE
Maplat::Web::TemplateCache - provide template caching and rendering
This module provides template rendering as well as caching the template files
During the reload() calls, this modules loads all template files in the configured directory into RAM and renders them quite fast.
The template rendering can optionally use "meta" rendering with a base template. This is for example used to render the complete layout of a page, and modules only have templates that use only the changing part of the page - this way, you only have to have one global layout and only write the changing part of the page for every module.
<module> <modname>templates</modname> <pm>TemplateCache</pm> <options> <view> <path>MaplatWeb/Templates</path> <base>/</base> </view> <view> <path>some/other/relative/path</path> <base>myothertemplates/</base> </view> <!-- Layout-Template to use for complete pages --> <layout>maplatlayout</layout> </options> </module>
layout is the template name used in meta-rendering.
The one public function to call in this module is get(), in the form of:
$templatehandle->get($name, $uselayout, %webdata);
$name if the name of the template file (without the .tt suffix)
$uselayout is a boolean, indicating if meta-rendering with the configured layout.
%webdata is a hash that is passed through to the template toolkit.
HTML-encodes (quotes) a scalar. Takes one argument (the value to quote) and returns the quoted value.
The reverse of quote(), takes an encoded value and returns the decoded (unquoted) one.
Similar to quote(), but HTML-encodes all values of an array. This works in-place, actually changing your array instead of working on a copy! Due to this, it should work on even huge arrays, with the downside of changing the callers data directly.
Takes one argument, a reference to the array to quote.
Warning: This function is designed to work only on simple arrays, elements that are references to sub-structures ( scalars, hashes, arrays, functions,...) will lead to undefined behavior!
Similar to quote(), but HTML-encodes all values of a hash. This works in-place, actually changing your hash instead of working on a copy! Due to this, it should work on even huge hashes, with the downside of changing the callers data directly.
Takes one argument, a reference to the hash to quote.
Warning: This function is designed to work only on simple hashes, elements that are references to sub-structures ( scalars, hashes, arrays, functions,...) will lead to undefined behavior!
This module is a basic web module and does not depend on other web modules.
Rene Schickbauer, <firstname.lastname@example.org>
Copyright (C) 2008-2011 by Rene Schickbauer
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.