[Overview][Constants][Procedures and functions] | Reference for unit 'pwumain' (#powtils_main) |
Source position: pwumain.pas line 146
function TemplateOut( |
const fname: String |
):errcode; |
begin SetVar('macrovar', 'value of var'); TemplateOut('somefile.tpl'); end.The TPL (template) file should look like:
<html> <body> This is a $macrovar </body> </html>
In versions of Powtils previous to 1.6.0.1, this function did not return errors, it just threw errors to the screen if warnings were on in the config file.
Many template engines eventually become programming languages themselves (and in many cases, MVC is not actually a reality) and no HTML designer can learn and master each and every template system out there (Smarty, and 560 others). The TemplateOut() function will always remain fairly simple, while with third party extensions we welcome more advanced template engines. There are plans to add an #include directive into the TemplateOut() function though, and any other simple features that users feel the need for.
The TemplateRaw function allows you to bypass security without any automatic filtering of malicious input that is done in TemplateOut.
The HTMLFilter parameter (in TemplateOut1 overloaded) tells the function whether or not to output filtered HTML for the macro variables. For example if you have set a macro var up that has less than and greater than symbols in it, these will be filtered first if htmlfilter is on.
Example: less than and greater than symbols are converted to html entities like & l t; and & g t;.