|
Re: [SMARTY] Any way to add values in a loop?: msg#00421php.smarty.general
You'd be better off supplying the sum as an assigned variable. It is much faster to do the math in PHP with array_sum(), and doing math shouldn't really be a duty of the template. But saying that, you can do it if you want. Put this in your loop: {math equation="x+y" x=$total y=$loopvar assign="total"} Monte On Wed, 2003-01-29 at 09:58, m guckeyson wrote: > Basically, I'd like to add up all the values of a foreach and display the > total after all the values are printed out as rows. I seem to recall seeing > a mechanism for doing this, but I can't find it now. Anyone able to jog my > memory? -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [SMARTY] Any way to add values in a loop?: 00421, m guckeyson |
|---|---|
| Next by Date: | [SMARTY] replacing tags: 00421, Uros Gruber |
| Previous by Thread: | [SMARTY] Any way to add values in a loop?i: 00421, m guckeyson |
| Next by Thread: | [SMARTY] replacing tags: 00421, Uros Gruber |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |