View previous topic :: View next topic |
Author |
Message |
tpanula Smarty Rookie
Joined: 19 May 2003 Posts: 6
|
Posted: Mon Dec 14, 2015 2:47 pm Post subject: extends append bug |
|
|
Just found out. Use default smarty 3.1.28, default install as downloaded. Have three template files as follows:
boilerplate.tpl:
{block name="scripts"}{/block}
base.tpl:
{extends file="boilerplate.tpl"}
{block name="scripts" append}
hurahuhhahhei
{/block}
index.tpl:
{extends file="base.tpl"}
{block name="scripts" append}
whatever
{/block}
Result:
Fatal error: Uncaught --> Smarty: inheritance: tag {$smarty.block.parent} used in parent template block 'scripts' <-- thrown in /var/www/smartybug2/smarty-3.1.28/libs/sysplugins/smarty_internal_runtime_inheritance.php on line 156 |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Dec 15, 2015 2:46 am Post subject: |
|
|
You have uses {block name="scripts" append} in the parent file index.tpl.
Option flags like append are only defined and useful for child templates.
See http://www.smarty.net/docs/en/language.function.block.tpl
Previous Smarty versions did not check for this error. |
|
Back to top |
|
tpanula Smarty Rookie
Joined: 19 May 2003 Posts: 6
|
Posted: Tue Dec 15, 2015 8:09 am Post subject: |
|
|
So, it's not a bug, but a feature? You have a peculiar sense of usefulness.
I see the append as a mechanism to add content into an existing block, which to me sounds quite useful. Sure, I can take the content from the parent block, put it to the include file and then separately include that content in the parent template, and then again in the subtemplate. But I really thought these blocks were meant to get rid of the include mess and provide some hierarchical way of designing templates.
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Dec 15, 2015 10:40 pm Post subject: |
|
|
tpanula wrote: | I really thought these blocks were meant to get rid of the include mess and provide some hierarchical way of designing templates. |
Yes, they do that.
Just not in the way you have thought they do. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Wed Dec 16, 2015 3:15 am Post subject: |
|
|
Sorry, I was wrong. I must check it out. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Thu Dec 17, 2015 8:32 pm Post subject: |
|
|
Turned out that this was cause by a bug. The fix is now in github in the master branch.
We will release 3.1.29 with bug fixes soon. |
|
Back to top |
|
jeffreydwalter Smarty n00b
Joined: 26 Oct 2012 Posts: 2
|
Posted: Sat Dec 19, 2015 8:46 am Post subject: |
|
|
U.Tews wrote: | Turned out that this was cause by a bug. The fix is now in github in the master branch.
We will release 3.1.29 with bug fixes soon. |
You Smarty devs need to get it together... You guys constantly introduce regression, especially in the template inheritance part of Smarty. *sigh* It's getting old already... Twig is looking better an better! |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Sat Dec 19, 2015 3:38 pm Post subject: |
|
|
jeffreydwalter wrote: | U.Tews wrote: | Turned out that this was cause by a bug. The fix is now in github in the master branch.
We will release 3.1.29 with bug fixes soon. |
You Smarty devs need to get it together... You guys constantly introduce regression, especially in the template inheritance part of Smarty. *sigh* It's getting old already... Twig is looking better an better! |
Someone has to do it. Are you volunteering? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Dec 21, 2015 9:43 pm Post subject: |
|
|
jeffreydwalter wrote: | U.Tews wrote: | Turned out that this was cause by a bug. The fix is now in github in the master branch.
We will release 3.1.29 with bug fixes soon. |
You Smarty devs need to get it together... You guys constantly introduce regression, especially in the template inheritance part of Smarty. *sigh* It's getting old already... Twig is looking better an better! |
When Smarty has a regression bug, a test case is added to minimize further regression. It's easy to avoid regression when your code base doesn't change much, if at all. When regression happens, that is usually a sign of big changes. Smarty is changing and adapting to better suit everyone's needs and take advantage of new things in PHP core. Despite it's vast feature set, Smarty is fast and lean with a small memory footprint. Don't take my word for it, benchmark it against the rest. People seem to think Smarty is old and lethargic just because it has been around awhile. Truth is, it is a very modern and actively developed template engine. Thanks goes to Uwe for all of his hard work.
[edit] this update include run-time template inheritance. Faster, more flexible inheritance system by basically replacing the entire existing inheritance code base to make it work this way. That is a lot of code change, and not an easy task to do and not have anything break. More test cases are being added to further strengthen the stability of this part of the code. |
|
Back to top |
|
|