There are two ways to judge whether the array is empty in the smarty template. The following is an example.
(1) Use the php count function
{If $ array | @ count gt 0} ...... {/if}
(2) This is a strange way of writing. Today, we can find this strange way of writing on the internet because the first method is not working.
{If count ($ array) gt 0} ...... {/if}
Articles you may be interested in
- The last record of the volist loop in the thinkphp Template
- How to generate a random number in the smarty Template
- Use php functions in the smarty template and how to use multiple functions for a variable in the smarty Template
- The cycle table in the smarty template contains incomplete td
- Add the latest tag to the information in the smarty Template
- Extension of the for loop in the smarty Template
- Js to determine whether an array contains repeated values
- How to Use constants defined by define in a program in a smarty Template