Open blaaat opened 5 months ago
I can make this work, but only when using the 'global' scope:
{assign var="b" value="x" scope="global"}
$smarty->getTemplateVars('b') // = 'x'
You're right, I must have made a mistake when testing this yesterday. Thanks :)
So this issue is mostly related to #878 Maybe it would be nice to have this backwards incompatible change documented in the changelog.
You are right. The change was documented in the changelog as "Template variable scope bubbling has been simplified and made more consistent. The global scope now equals the Smarty scope in order to avoid global state side effects. Please read the documentation for more details." This doesn't really suggest what could go wrong, but I hadn't forseen this either to be honest.
Hi,
In Smarty 4 it was possible to assign a variable inside a template and use this after fetching in code.
{assign var="var" value=$from_name scope="root"}
$smarty->getTemplateVars()
In smarty 5.0.2 this only returns the variables assigned in PHP. Tried to change the (undocumented) scope to global without success