Closed GildedHonour closed 6 years ago
You will need to define a helper for that. Also you can call that function before rendering the template, and pass the result data into the template.
I can't call it before, I'll need to call it from a template. In the "examples" there's no such an example, is there one?
I can't call it before, I'll need to call it from a template. In the "examples" there's no such an example, is there one?
There is an example here https://github.com/sunng87/handlebars-iron/blob/master/examples/server.rs#L104
You can define a helper like some_helper
and put your function in. Then call it from your template by something like {{some_helper 1 2 3}}
.
For example of handlebars helper, you can find here: https://github.com/sunng87/handlebars-rust/blob/master/examples/render.rs#L13
How can I call my own custom function from a template?