my english is poor,sorry!
I just want to do this,in layout
<html>
....
{{yield}}
.....
{{res}}
<html>
now,I have a index file named index.html.in the same dir,i have an other file name index.html.res.
I want the index.html into the yield,and the index.html.res to the {{res}}
I try to do it with Funcs,but i cant get the .res file path.
engine.Use(render.Renderer(render.Options{
// Specify what path to load the templates from.
Directory: conf.AppDir.View,
// Specify a layout template. Layouts can call {{ yield }} to render the current template.
Layout: "layout/default",
// Specify extensions to load for templates.
Extensions: []string{".tmpl", ".html"},
// Specify helper function maps for templates to access.
Funcs: []template.FuncMap{{
"res":func(args ...interface{}) template.HTML {
// here i cant get the .res path
return template.HTML(s)
},
}},
// Sets delimiters to the specified strings.
Delims: render.Delims{"{{", "}}"},
// Sets encoding for json and html content-types. Default is "UTF-8".
Charset: "UTF-8",
// Output human readable JSON
IndentJSON: true,
}))
my english is poor,sorry! I just want to do this,in layout
now,I have a index file named index.html.in the same dir,i have an other file name index.html.res. I want the index.html into the yield,and the index.html.res to the {{res}}
this is the dir like.
every res file content is different.How to do it?
I try to do it with Funcs,but i cant get the .res file path.