Dot Notation

bobthecow edited this page Mar 7, 2012 · 1 revision

Dot Notation

Dot notation is a shortcut syntax for quickly accessing methods or properties of variables.

Given the following context:

<?php
array(
    'foo' => array(
        'bar' => array(
            'baz' => 'qux',
        ),
    ),
);

You can use dot notation to access the attributes of a variable:

{{foo.bar.baz}}

Which will render as "qux".

This can be thought of as (approximately) equivalent to the following nested sections:

{{#foo}}{{#bar}}{{baz}}{{/bar}}{{/foo}}

Note that it is only approximately equivalent, as the rules for variable resolution differ somewhat between the two examples.