Output

There are two methods of output with EVML, output tags and write functions within EV Script.

{{ ... }} Output Tags

The "double curlies" may be used anywhere in your EVML files except within an EV Script code block. You can use also use output tags within editable regions and within the CMS Editor. For example:

<body>
    <div>
        <!-- Output tag in your EVML file -->
        <h1>{{ page.title }}</h1>
        
        <!-- Within an editable region -->
        <ev:editable id="Main">
            Written by {{ page.author }}
        </ev:editable>
        
        <!-- Within a global editable block -->
        <ev:translate langid="IDENTIFIER">
            <lang:en>Hello {{ shop.name }}</lang:en>
            <lang:fr>Bonjour {{ shop.name }}</lang:fr>
        </ev:translate>
    </div>
</body>

{{ ... }} within editable regions

As you can see above it is perfectly acceptable to add Output Tags within an editable region. When a user logs into Evance's CMS Editor they will see the Output Tag in its raw format and not the replacement value. 

Conditional output

There may be occasions where you think "hey wouldn't it be great if I could have conditional output?", well you can to an extent with Output Tags. For example:

<body>
    <div>
        Page has {{ page.hasChildren ? page.children.total : 'no' }} children
    </div>
</body>

Escaping Output Tags

There may be some instances where you might like to use the "double curlies" for client-side template processing e.g. Angular JS. So, to facilitate your need we've introduced a way to escape "double curlies" and that's with "triple curlies". Yep, all you need to do is this:

<body>
    <div>
        <?ev
            var greeting = 'Hello';
        ?>
        <p>{{ greeting }} will render as "Hello".</p>
        
        <p>{{{ greeting }}} will render as "{{ greeting }}".</p>
    </div>
</body>

Output functions in EV Script

There are three output functions because we couldn't decide on what we preferred.

<?ev
    // which do you prefer?
    print('Hello World!');
    write('Hello World!');
    echo('Hello World!');
?>