Re: [SMARTY-DEV] Pass Smarty reference to modifiers
| From: | boots | Date: | Wed, 02 Jun 2004 15:08:59 +0000 |
| Subject: | Re: [SMARTY-DEV] Pass Smarty reference to modifiers | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-2382@lists.php.net to get a copy of this message | ||
--- Dmitry Koteroff <delete@koteroff.ru> wrote:
> Hello.
>
> Smarty.class.php, line 1696.
>
> function _run_mod_handler()
> {
> ...
> foreach ($_var as $_key => $_val) {
> $_args[0] = $_val;
> $_var[$_key] = call_user_func_array($_func_name, $_args);
> }
> ...
> }
>
> Why not to pass $this to modifier function? It's easy and
> back-compatible:
>
> call_user_func_array($_func_name, $_args, &$this);
I've asked for this before:
http://www.phpinsider.com/smarty-forum/viewtopic.php?t=185
Recall that plugin functions do not receive modifier paramaters as an
array, but instead as individual paramaters, so unless I am reading
your solution incorrectly, it is not quite as simple as that.
But it is a good idea :) Another interesting enhancement would be to
figure out a way to get modifiers to be handled at compile-time instead
of strictly at runtime.
Perhaps you will like my denegrated solution to add spaces to modifier
syntax?
http://news.php.net/article.php?group=php.smarty.dev&article=1999
Cheers,
xo boots
__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/