AmphetaDesk::Templates - Encapsulates the templating engine of AmphetaDesk
# include another template. [$ include( $file_path ) $] # send data to the browser. two different ways. $OUT .= "this is sent to the browser immediately. # this is delayed until send_to_browser is called. to_browser("random crap for the ", $browser", "whoooO"); to_browser("the above was an array. this is a string."); $OUT = send_to_browser;
This package encapsulates all the various template handling code. It uses Text::Template to parse the templates, and then sends the results back to the calling function for further action. Simple stuff. More user-level information about this template can be found in the "Skinning" doc. All URLs accessed through the AmphetaDesk webserver (save for images) are parsed for templating code. This allows you to make new templates up as you go, and have them immediately available for use through the webserver.
include($file_path)
to_browser
and send_to_browser
to_browser
), and only concat things together when we're done everything else via send_to_browser
). You can, of course, choose not to use these routines when it's not needed, such as small templates. If that's the case, you can send straight to Text::Template's $OUT. An example of usage:$OUT .= "this is sent to the browser immediately. # this is delayed until send_to_browser is called. to_browser("random crap for the ", $browser", "whoooO"); to_browser("the above was an array. this is a string."); $OUT = send_to_browser;
to_browser
always returns 1, and send_to_browser
returns a giant string of all the data that has previously been set with to_browser
- it'll delete the internally saved data upon output. More information about these routines can be found in the "Skinning" docs.Morbus Iff, <morbus@disobey.com>
Copyright 2000-2004 Morbus Iff <morbus@disobey.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.