This plugin is a wrapper for the Handlebars for golang library.
Follow the instructions in our manual to add our package repository and then run the below command.
apt-get install halon-extras-handlebars
yum install halon-extras-handlebars
These functions needs to be imported from the extras://handlebars module path.
Render a handlebars template.
Params
- template
string- The template - context
array- The context
Returns
A successful render will return an associative array with a result key that contains the HTML. On error an associative array with a error key will be provided.
Example
import { handlebars } from "extras://handlebars";
$template = ''<div>
<h1>{{title}}</h1>
<div class="body">
{{body}}
</div>
</div>
'';
echo handlebars($template, [
"title" => "This is my title",
"body" => "This is my body"
]);