summaryrefslogtreecommitdiff
path: root/vendor/zordius/lightncandy/tests/example_debug.php
blob: bc573e0da50a390d6fb480f7a5e2efdca02b9860 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require('src/lightncandy.php');

$template = "Hello! {{name}} is {{gender}}.
Test1: {{@root.name}}
Test2: {{@root.gender}}
Test3: {{../test3}}
Test4: {{../../test4}}
Test5: {{../../.}}
Test6: {{../../[test'6]}}
{{#each .}}
each Value: {{.}}
{{/each}}
{{#.}}
section Value: {{.}}
{{/.}}
{{#if .}}IF OK!{{/if}}
{{#unless .}}Unless not OK!{{/unless}}
";

$php = LightnCandy::compile($template, Array(
    'flags' => LightnCandy::FLAG_RENDER_DEBUG | LightnCandy::FLAG_HANDLEBARSJS
));

$renderer = LightnCandy::prepare($php);
error_reporting(0);
echo $renderer(Array('name' => 'John'), LCRun3::DEBUG_TAGS_ANSI);
?>