|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
subetha Smarty n00b
Joined: 14 Aug 2017 Posts: 2
|
Posted: Mon Aug 14, 2017 6:17 pm Post subject: Smarty 3.1.31 errors with section and associative arrays |
|
|
Hello,
i have updated from Smarty 3.1.12 to 3.1.31 in order to make use of the autoloader.
I have used associative arrays so far without any issues. $data is one big array that hold all the template data. $data['categories'] is an indexed array.
But now I am seeing errors when using sections: Notice: Undefined index: __smarty_section_cat in (template_file)
Code: | {section name=cat loop=$data.categories}
....
{/section}
|
In the compiled template the faulty line reads:
Code: | $__section_men_0_total = $_smarty_tpl->tpl_vars['__smarty_section_cat']->value['loop'];
|
In my template i have several sections with similar data. Another one is assigned to the _same_ data and the compiled templates is:
Code: | $__section_kat_4_loop = (is_array(@$_loop=$_smarty_tpl->tpl_vars['data']->value['categories']) ? count($_loop) : max(0, (int) $_loop));
|
It seems that the first {section} is compiled, so that some checks are missing, but the second one is allright.
Any ideas what might be the issue?
Thanks, Christian |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Nov 06, 2017 4:19 am Post subject: |
|
|
Hello
This was a bug when both {$smarty.section.name.loop} and{$smarty.section.name.total} had been used.
The fix is now on github in the master branch and will later be included in version 3.1.32 |
|
Back to top |
|
subetha Smarty n00b
Joined: 14 Aug 2017 Posts: 2
|
Posted: Mon Nov 06, 2017 10:31 am Post subject: |
|
|
Thanks!
Good to know that, looking forward to the new release.
Best, Christian |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|