functions, modifier explaining themselves
| From: | Ulf Wendel | Date: | Wed, 26 Jun 2002 09:44:46 +0000 |
| Subject: | functions, modifier explaining themselves | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-5023@lists.php.net to get a copy of this message | ||
Hi!
I need some input on functions and modifiers explaining themselves. As I I hate writing documentation and I strongly appreciate all kinds of "self documentation". Talking on some kind of smarty plugins "self documentation" could mean that there's a plugin function called help that's able to dump (at least) the syntax of all currently registered functions and modifiers.
The last time I set up an application using Smarty (1.4) I had to write quite some modfiers and functions. I soon started to write some helper function checking the syntax of a function/modifier call. So they all looked like this:
function smarty_func_foo($params, &$smarty) {
...
if ($err = check_func_syntax($params, $foo_syntax))
bail("wrong syntax..." . $err);
...
}
function smarty_mod_foo() {
$args = func_get_argv();
if ($err = check_mod_syntax($args, $foo_syntax))
bail("wrong syntax: " . $err);
. ...
}
This gave me quite helpful error messages. Is anyone using something similar? If so: did you implement a help() plugin function that's capable to show the syntax of a plugin? Did you write a list_all_plugins() plugin function that dumps a list of all available plugins? How did you find out which plugins have been loaded, is there a (private) Smarty function I can abuse to retrieve such a list?
Thanks in advice!
Ulf
PS: Excuse my bad mail archive lookup on the last question.