XaminProject / handlebars.php

Handlebars processor for php
331 stars 134 forks source link

Allow each helper to accept PHP Generators #34

Closed craigjbass closed 10 years ago

craigjbass commented 10 years ago

Output from the following function:

function getItems() {

   //Some code

   while( $stream->more() ) {
      yield [ 'id' => $stream->id(), 'text' => $stream->text() ];
   }
}

Can now be directly fed as follows:


{{#each items}}
   {{id}} - {{text}}
{{/each}}
everplays commented 10 years ago

Thanks.