diff options
author | Mario <mario@mariovavti.com> | 2022-02-11 09:27:57 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-02-11 09:27:57 +0000 |
commit | 615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed (patch) | |
tree | 9a2eb293fde70e7222957557dbfe6c3ab1df86f2 /vendor/smarty/smarty/docs/programmers/advanced-features/advanced-features-postfilters.md | |
parent | 7d75d0cfbdca9914814dd5c8390a45eaf377b48d (diff) | |
download | volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.tar.gz volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.tar.bz2 volse-hubzilla-615c9f1cbe2ccf9c33b035bcf04c5bc6bf64c7ed.zip |
composer update smarty to version 4.1 - new files
Diffstat (limited to 'vendor/smarty/smarty/docs/programmers/advanced-features/advanced-features-postfilters.md')
-rw-r--r-- | vendor/smarty/smarty/docs/programmers/advanced-features/advanced-features-postfilters.md | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/vendor/smarty/smarty/docs/programmers/advanced-features/advanced-features-postfilters.md b/vendor/smarty/smarty/docs/programmers/advanced-features/advanced-features-postfilters.md new file mode 100644 index 000000000..d3bad546a --- /dev/null +++ b/vendor/smarty/smarty/docs/programmers/advanced-features/advanced-features-postfilters.md @@ -0,0 +1,40 @@ +Postfilters {#advanced.features.postfilters} +=========== + +Template postfilters are PHP functions that your templates are ran +through *after they are compiled*. Postfilters can be either +[registered](#api.register.filter) or loaded from the [plugins +directory](#variable.plugins.dir) by using the +[`loadFilter()`](#api.load.filter) function or by setting the +[`$autoload_filters`](#variable.autoload.filters) variable. Smarty will +pass the compiled template code as the first argument, and expect the +function to return the result of the processing. + + + <?php + // put this in your application + function add_header_comment($tpl_source, Smarty_Internal_Template $template) + { + return "<?php echo \"<!-- Created by Smarty! -->\n\"; ?>\n".$tpl_source; + } + + // register the postfilter + $smarty->registerFilter('post','add_header_comment'); + $smarty->display('index.tpl'); + ?> + + + +The postfilter above will make the compiled Smarty template `index.tpl` +look like: + + + <!-- Created by Smarty! --> + {* rest of template content... *} + + + +See also [`registerFilter()`](#api.register.filter), +[prefilters](#advanced.features.prefilters), +[outputfilters](#advanced.features.outputfilters), and +[`loadFilter()`](#api.load.filter). |