|
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 |
bingomanatee Smarty n00b
Joined: 25 Feb 2006 Posts: 1
|
Posted: Tue Dec 19, 2006 12:44 am Post subject: count of array; if condition |
|
|
I want a block of code to execute ONLY if an array has contents; how can I test to find out how many elements are in an array within Smarty (or more generally, find an array count within smarty)? |
|
Back to top |
|
Hielke Hoeve Smarty Elite
Joined: 06 Jan 2006 Posts: 406 Location: Netherlands
|
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Dec 19, 2006 3:25 pm Post subject: |
|
|
Code: | {if !empty($myarray)}...{/if} |
Code: | {if $myarray|@count gt 0}...{/if} |
|
|
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
|