mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
Add a 'ParseTemplate' method on view engines to manually parse and add a template from a text
examples at: https://github.com/kataras/iris/tree/master/_examples/view/parse-template relative to: https://github.com/kataras/iris/issues/1617
This commit is contained in:
@@ -10,13 +10,13 @@ func main() {
|
||||
app.Logger().SetLevel("debug")
|
||||
|
||||
// Init the handlebars engine
|
||||
engine := iris.Handlebars("./templates", ".html").Reload(true)
|
||||
e := iris.Handlebars("./templates", ".html").Reload(true)
|
||||
// Register a helper.
|
||||
engine.AddFunc("fullName", func(person map[string]string) string {
|
||||
e.AddFunc("fullName", func(person map[string]string) string {
|
||||
return person["firstName"] + " " + person["lastName"]
|
||||
})
|
||||
|
||||
app.RegisterView(engine)
|
||||
app.RegisterView(e)
|
||||
|
||||
app.Get("/", func(ctx iris.Context) {
|
||||
viewData := iris.Map{
|
||||
|
||||
Reference in New Issue
Block a user