Re: Pass Smarty reference to modifiers
boots <[email protected]>
| Newsgroups | gmane.comp.php.smarty.devel |
|---|---|
| Message-ID | <[email protected]> |
--- Dmitry Koteroff <[email protected]> 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/ -- Smarty Development Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php