-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange behavior in smarty 3.1.30 #297
Comments
… Smarty::fetch() calls the template and config variables must be cleared #297
This bug is fixed now in the master branch. Just some notes: class Widget
{
public function render($data, $template)
{
$template->smarty->assign('name', $data['name']);
return "assing in smarty {$data['name']} - " . $template->smarty->fetch($data['tpl']);
}
} The your Widget class does update the template variable 'name' only in the Smarty object. This change <html>
<body>
<p>Hello world!!!</p>
{include file='templates/widget.tpl' name='smarty'}
{widget name='smarty_1' tpl='templates/widget.tpl'}
{widget name='smarty_2' tpl='templates/widget.tpl'}
{include file='templates/widget.tpl' name='smarty'}
</body>
</html> Will output <html>
<body>
<p>Hello world!!!</p>
<p>Hello smarty!!!</p>
assing in smarty smarty_1 - <p>Hello smarty_1!!!</p>
assing in smarty smarty_2 - <p>Hello smarty_2!!!</p>
<p>Hello smarty!!!</p>
</body>
</html> |
Thank you for your help. |
Every other user might be using the same template from another template and then from PHP. I am, for sure, and tracking this down was not fun. |
Hello! I have a problem with smarty 3.1.30. I wrote this code
index.tpl
or index.tpl
widget.tpl
In the issue
When template has {include} tag where the file attribute is the same path in the users plugin, then smarty assign in the users plugin doesn't override current template variables. In smarty 3.1.27 it works.
The text was updated successfully, but these errors were encountered: