Which is the better way to write an if condition in Smarty?
{if $searchCount > 0}
{if $searchCount}
{if $searchCount == 0}
{if !$searchCount}
It depends on what you want.
Example A:
$searchCount
is greater than 0
.Example B:
$searchCount
is true
. It's true if it's filled. No matter whats inside.Example C:
$searchCount
is equal to 0
.Example D:
$searchCount
is false
. It's false
if its not filled or it's the bool false
.I hope this helps you to understand the operators.
See the PHP-Manual or W3-Schools for more informations.