XaminProject / handlebars.php

Handlebars processor for php
331 stars 134 forks source link

support for @first/@last in #each helper #46

Closed nonnenmacher closed 10 years ago

nonnenmacher commented 10 years ago

in the handlebars.js reference, there is a paragraph on automatic variables available in the each context.

"The first and last steps of iteration are noted via the @first and @last variables when iterating over a array. When iterating over an object only the @first is available."

I don't see support for those two variables in the source, is this planed or did I miss them ?

everplays commented 10 years ago

Actually, compatibility with handlebars.js is a work in progress so there might be features that don't exist in php port because no one needed them so far, @first and @last are among them. You can implement them yourself and make a PR :)

P.S. have a look at implementation of @index or @key, they should help you out. On Feb 4, 2014 4:05 PM, "Vincent Nonnenmacher" notifications@github.com wrote:

in the handlebars.js reference, there is a paragraph on automatic variables available in the each context.

"The first and last steps of iteration are noted via the @firsthttps://github.com/firstand @last https://github.com/last variables then iterating over an array. When iterating over an object only the @first https://github.com/firstis available."

I don't see support for those two variables in the source, is this planed or did I miss them ?

— Reply to this email directly or view it on GitHubhttps://github.com/XaminProject/handlebars.php/issues/46 .

everplays commented 10 years ago

It's implemented in #51, so I'm closing it.