File tree 2 files changed +34
-0
lines changed
2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use DevTheorem \Handlebars \{Handlebars , Options };
4
+
5
+ require 'vendor/autoload.php ' ;
6
+
7
+ $ templateString = '{{> StrongPartial text="Use the syntax: {{varName}}."}} ' ;
8
+
9
+ $ template = Handlebars::compile ($ templateString , new Options (
10
+ partials: [
11
+ 'StrongPartial ' => '<strong>{{text}}</strong> ' ,
12
+ ]
13
+ ));
14
+
15
+ echo $ template ([
16
+ 'varName ' => 'Hello ' ,
17
+ ]);
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ use DevTheorem \Handlebars \{Handlebars , HelperOptions , Options };
4
+
5
+ require 'vendor/autoload.php ' ;
6
+
7
+ $ templateString = '{{test "\"\"\"" prop="\"\"\""}} ' ;
8
+
9
+ $ template = Handlebars::compile ($ templateString , new Options (
10
+ helpers: [
11
+ 'test ' => function ($ arg1 , HelperOptions $ options ) {
12
+ return "{$ arg1 } {$ options ->hash ['prop ' ]}" ;
13
+ },
14
+ ]
15
+ ));
16
+
17
+ echo $ template ();
You can’t perform that action at this time.
0 commit comments