-
Notifications
You must be signed in to change notification settings - Fork 714
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
Inheritance / {extend} - Outputs result of previous fetch again #312
Comments
Interesting case. $smarty->fetch('child.tpl', null, 1); I will try to find a solution with out the work around. Perhaps a useful performance by creating template objects. $child = $smarty->createTemplate('child.tpl',null,1);
$base = $smarty->createTemplate('base.tpl');
$smarty->assign('e',new Child( 1 ));
$child->fetch();
$smarty->assign('e',new Child( 2 ));
$child->fetch();
$smarty->assign('e',new BaseClone( 3 ));
$base->fetch();
$smarty->assign('e',new BaseClone( 4 ));
$base->fetch(); |
Simplest workaround I found was creating a copy of the Nevertheless I would appreciate a fix in the source code. Good luck finding a solution! 👍 |
This problem does not occur the dev-master version due to changes in template object caching. |
I tested it with your latest commit (e867ae1) and it worked. I then altered
Somehow the Changes:
public function getText()
{
return $this->getHTML();
} and
I updated my repo so you can test it: https://github.com/SpazzMarticus/smarty-bug Maybe you could reopen the issue and I hope you can fix it. |
…ch() or Smarty::isCached() the inheritance data must be removed #312
It has bin now finally fixed in the master branch |
Took me a while but I found a strange behaviour when using Inheritance and
{extend}
Setup: I got a
Base
class which should use thebase.tpl
and aChild
class (Child
extendsBase
) which should use thechild.tpl
(Thechild.tpl
uses{extend 'base.tpl'}
)And I got a
BaseClone
which is justclass BaseClone extends Base{ /* Nothing here */ }
and should use thebase.tpl
(Let's assume the output is an ID and the class.)
Templates:
base.tpl
child.tpl
The problem:
Base
s andBaseClone
s everything is fine.Child
and thenBaseClone
s everything is fine too.Child
s and then try to fetchBaseClone
s I end up getting the result of a previousChild
again and again.Premise:
Output OK:
Premise:
Output FAILED:
I set up some testing in this repository: https://github.com/SpazzMarticus/smarty-bug
The text was updated successfully, but these errors were encountered: