Re: [SMARTY] plugin & assign weirdness
| From: | messju mohr | Date: | Mon, 16 Feb 2004 07:27:46 +0000 |
| Subject: | Re: [SMARTY] plugin & assign weirdness | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-10951@lists.php.net to get a copy of this message | ||
Hello,
On Mon, Feb 16, 2004 at 03:34:05AM +0100, David Spreekmeester wrote:
> Hello,
>
> Writing a function plugin for Smarty, I keep on running in to the
> problem of using assign() to set a template variable. This doesn't
> seem to work as it should if I understand the manual correctly.
>
> Returning a value from the function works fine, but when I try to
> assign a variable to the template ($smarty->assign), nothing comes
> through in the output nore in the debug console.
> I can however *retrieve* a template variable (by get_template_vars())
> and return it from the function. Because I can reach the template from
> within the plugin, but not the other way around (as it seems), I
> kind of excluded the possibility of a scope issue.
My guess is you don't pass the $smarty object by reference:
you declared it (wrong):
function smarty_function_plugin($params, $smarty)
instead of (correct):
function smarty_function_plugin($params, &$smarty)
if so, you are working on a copy of $smarty in your function.
greetings
messju
> So does it have to do with order in the parsing process or...?
> I can't find much information on a problem like this.
>
>
> does this make sense to anyone?