if,elseif,else function

if,elseif,else function:

The if statement in Smarty is as flexible and easy to use as the if statement in PHP, and has added Several features to suit template engines.

if must appear paired with /if. Can be used else and elseif clauses. You can use the following conditional modifiers:

eq, ne, neq, gt, lt, lte, le, gte, ge, is even, is odd, is not even,

is not odd, not, mod, div by, even by, odd by, ==, !=, >, <, <=, > =.

When using these modifiers, they must be separated from variables or constants by spaces.

eg:

{if $name eq "Fred"}
Welcome Sir.
{elseif $name eq "Wilma"}
Welcome Ma'am.
{else}
Welcome , whatever you are.
{/if}

Continuing Learning
||
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!