|
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 |
ueilmaster Smarty n00b
Joined: 24 Jul 2020 Posts: 1
|
Posted: Fri Jul 24, 2020 2:36 pm Post subject: Addition value in foreach cycle |
|
|
I need to get a total of values in every iteration of a foreach
for example
I've got Width value, for every iteration need a total of width's value to use in a math equation
{foreach from=$data_table item=curr name="ciclone"}
{math equation='(x+y)+(g*z)' x='100' y='1400' g='50' z="{$smarty.foreach.ciclone.iteration}"}
{/foreach}
z is the current iteration,
g and x are variables get from array,
Y= the amount of total width dawn current iteration;
{$curr.Width} is each value in the array $data_table, not the same for every iteration,
I need something like examples:
$total_width till 1 dawn {$smarty.foreach.ciclone.iteration}
500 = 500 + (till 1 dawn 1)
800 = 500+300 (till 1 dawn 2)
1500 = 500+300+700 (till 1 dawn 3) ...
hope I have been clear
thanks in advance |
|
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
|