Closed max107 closed 11 months ago
<?php ini_set('display_errors', 'On'); include '../puja.php'; $tpl = new Puja; $tpl->template_dir = 'templates/'; $tpl->cache_dir = 'cache/'; class Test { public function b() { return 321; } } $tpl->parse('test.tpl', [ 'a' => new Test ]);
Template:
{{ a.b }}
Compiled template:
<?php $pujaFilter = new TemplateFilter; $pujaTags = new TemplateTags; $ast_puja_template = ''; $ast_puja_template .= (isset($a['b']) ? $a['b'] : null); $ast_puja_template .= '';
In this version, Puja don't support to access a method, but it can access to property. We noted this idea for next version.
Thanks to @max107
Template:
Compiled template: