smarty shorthand if 1

smarty shorthand if

// Besides true and false, you can also use 1 or 0
// You have to use brackets around the condition,
// even if its just a single var.

{($bloke) ? 'Male' : 'Female'}

Here is what the above code is Doing:
1. It’s checking if $bloke is true.
2. If it is, it prints ‘Male’.
3. If it isn’t, it prints ‘Female’.

Similar Posts