if...else

The if statement executes a block of code if a specified condition is true. If the condition is false, another statement can be executed.

Syntax

<?ev
    // example 1
    if (condition) {
        code block executed if condition is true
    }
    
    // example 2
    if (condition) {
        code block executed if condition is true
    } else {
        code block executed if condition is false
    }
    
    // example 3
    if (condition1) {
        code block executed if condition1 is true
    } else if (condition2) {
        code block executed if condition1 is false and condition2 is true
    } else {
        code block executed if condition1 is false and condition2 is false
    }
?>

Note EVML requires curly brackets ({...}) code block execution even for single statements.

Example

Usually we want to wrap HTML in a conditional statment

<?ev if (website.isCommerce) { ?>
    You have an e-commerce website
<?ev } else if (website.isCatalogue) { ?>
    You have a product catalogue
<?ev } else { ?>
    Yours is a CMS website
<?ev } ?>
COVID-19 NOTICE – Business as Usual
Evance continues to provide all services and support throughout this difficult period. See our full statement here .