XaminProject / handlebars.php

Handlebars processor for php
331 stars 132 forks source link

No support for ArrayLoader #9

Closed hezronobuchele closed 11 years ago

hezronobuchele commented 11 years ago

Hi,

When do you plan on implementing the ArrayLoader? The engine lacks support for loading an array of partials on instantiation which limits the location of all partials to just one predefined folder if using the FilesystemLoader. This doesn't allow one to create flexible template systems within their app where the partials can be located in different locations depending on their purpose e.g.

-> layout.handlebars -> header.handlebars -> footer.handlebars -> sidebar.handlebars

-> widgets/ --> calendar.handlebars

-> blocks/ --> breadcrumb.handlebars --> menu.handlebars --> pagination.handlebars

-> contentblocks/ --> list.handlebars --> edit.handlebars --> table.handlebars

fzerorubigd commented 11 years ago

Now you can pass array of paths to file system loader.

hezronobuchele commented 11 years ago

Thanks, that works as well for me. But for cases where you have a dynamic partial such as "body" for instance, you'll have to load the main layout template into a string variable, replace {{>body}} with {{>"actual_partial_file_name"}} and then render the partial.

Is it possible to have a registerPartial() function such as in the JavaScript version? This allows you to bind a dynamic partial like body with a different file depending on the page e.g. use registerPartial("body", "contentblocks/list") when using the FileSystem loader as the partials loader and registerPartial("body", "Hello, {{name}}") for the StringLoader?

fzerorubigd commented 11 years ago

@hezbucho Sorry for my mistake. About the another request, can you please open another issue? Thank you.

hezronobuchele commented 11 years ago

Thanks. Sorry for that, just did #10