How can I get the total number of items in an array using Smarty? Can I use {$smarty.foreach.foo.total}
?
Asked
Active
Viewed 5.5k times
1 Answers
59
This question is answered on Smarty's FAQ page: http://smarty.incutio.com/?page=SmartyFrequentlyAskedQuestions#template-1
Q: How do I count the number of elements in an array?
A: {$array|@count}
The @
applies the modifier directly to the array instead of each individual element.

Roko C. Buljan
- 196,159
- 39
- 305
- 313

David
- 786
- 6
- 2