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/api-variables/variable-default-config-handler-func.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/api-variables/variable-default-config-handler-func.md')
-rw-r--r-- | vendor/smarty/smarty/docs/programmers/api-variables/variable-default-config-handler-func.md | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/vendor/smarty/smarty/docs/programmers/api-variables/variable-default-config-handler-func.md b/vendor/smarty/smarty/docs/programmers/api-variables/variable-default-config-handler-func.md new file mode 100644 index 000000000..0d6ec5e0d --- /dev/null +++ b/vendor/smarty/smarty/docs/programmers/api-variables/variable-default-config-handler-func.md @@ -0,0 +1,50 @@ +\$default\_config\_handler\_func {#variable.default.config.handler.func} +================================ + +This function is called when a config file cannot be obtained from its +resource. + +> **Note** +> +> The default handler is currently only invoked for file resources. It +> is not triggered when the resource itself cannot be found, in which +> case a SmartyException is thrown. + + + <?php + + $smarty = new Smarty(); + $smarty->default_config_handler_func = 'my_default_config_handler_func'; + + /** + * Default Config Handler + * + * called when Smarty's file: resource is unable to load a requested file + * + * @param string $type resource type (e.g. "file", "string", "eval", "resource") + * @param string $name resource name (e.g. "foo/bar.tpl") + * @param string &$content config's content + * @param integer &$modified config's modification time + * @param Smarty $smarty Smarty instance + * @return string|boolean path to file or boolean true if $content and $modified + * have been filled, boolean false if no default config + * could be loaded + */ + function my_default_config_handler_func($type, $name, &$content, &$modified, Smarty $smarty) { + if (false) { + // return corrected filepath + return "/tmp/some/foobar.tpl"; + } elseif (false) { + // return a config directly + $content = 'someVar = "the config source"'; + $modified = time(); + return true; + } else { + // tell smarty that we failed + return false; + } + } + + ?> + + |