jbboehr / php-mustache

Mustache PHP Extension
MIT License
56 stars 22 forks source link

Loading a template from the filesystem with partials resolution: an example. #66

Closed gjcarrette closed 2 years ago

gjcarrette commented 2 years ago

This mustache implementation is fast, well known, stable, and extensively used in some big applications.

Questions such those raised in issues https://github.com/jbboehr/php-mustache/issues/45 and https://github.com/jbboehr/php-mustache/issues/4 suggest that examples of template loading, AST walking, and partials resolution would be helpful. In the spirit of php.net documentation I have just added an examples section to the end of the README.md and provided an example covering all 3 topics.

The Mustache_Template_Loader class is extracted from production code. The implementation of the resolve_partials function does suggest that it would be nice to expose as constants in the MustacheAST class the type enum from https://github.com/jbboehr/libmustache/blob/master/src/node.hpp

jbboehr commented 2 years ago

Thanks!