File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -24,14 +24,27 @@ Templating
2424Templates can be loaded from the file system. The following loads and transforms the template * src/main/handlebars.handlebars* :
2525
2626``` php
27- use com\handlebarsjs\{ HandlebarsEngine, FilesIn} ;
27+ use com\handlebarsjs\HandlebarsEngine;
2828
29- $engine= (new HandlebarsEngine())->withTemplates(new FilesIn( 'src/main/handlebars') );
29+ $engine= (new HandlebarsEngine())->withTemplates('src/main/handlebars');
3030$transformed= $engine->transform('hello', [
3131 'name' => 'World'
3232]);
3333```
3434
35+ Templates can also be declared inline:
36+
37+ ``` php
38+ use com\handlebarsjs\HandlebarsEngine;
39+
40+ $engine= (new HandlebarsEngine())->withTemplates(['test' => 'Hello {{name}}']);
41+ $transformed= $engine->transform('hello', [
42+ 'name' => 'World'
43+ ]);
44+ ```
45+
46+ If you need more flexibility, you can implement and then pass instances of ` com.github.mustache.templates.Templates ` .
47+
3548Helpers supported
3649-----------------
3750The following helpers are built in:
You can’t perform that action at this time.
0 commit comments