Skip to content
This repository has been archived by the owner. It is now read-only.

Added support for @first and @last in each helper; closes #110 #111

Merged
merged 1 commit into from Feb 17, 2015

Conversation

Projects
None yet
2 participants
@bcole808
Copy link

commented Feb 17, 2015

When using the {{#each}} helper, the variables @first and @last should be set to the boolean TRUE or FALSE to indicate if the current item is the first or last of the array.

This code works when using the following template syntax, even with many nested loops:

{{#each machine}}
    The machine is made up of these parts:
    {{#each parts}}
    <li>{{part_name}}</li>
    {{/each}}
{{/each}}

However, this will not work if the helper is not explicitly called. For example, this code will not receive the @first and @last variables:

{{# machine}}
    The machine is made up of these parts:
{{/ machine}}

TO-DO:

Move this logic to the Template.php file so that these special variables can be set when iterating over blocks that do not explicitly use the {{#each}} helper tag.

fzerorubigd added a commit that referenced this pull request Feb 17, 2015

Merge pull request #111 from bcole808/php-52
Added support for @FIRST and @last in each helper; closes #110

@fzerorubigd fzerorubigd merged commit 1d076fa into XaminProject:php-52 Feb 17, 2015

@fzerorubigd

This comment has been minimized.

Copy link
Member

commented Feb 17, 2015

Thank you. Since we actually depricate the 5.2 branch, and there is no test (for that branch), I accept this without any test.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.