This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"io"
|
||||
)
|
||||
|
||||
type Templates struct {
|
||||
tmpl *template.Template
|
||||
}
|
||||
|
||||
func NewTemplates(tmpl *template.Template) *Templates {
|
||||
return &Templates{tmpl: tmpl}
|
||||
}
|
||||
|
||||
func (t *Templates) Render(w io.Writer, name string, data any) {
|
||||
_ = t.tmpl.ExecuteTemplate(w, name+".html", data)
|
||||
}
|
||||
Reference in New Issue
Block a user