alps/template.go
2019-12-02 15:31:00 +01:00

24 lines
413 B
Go

package koushin
import (
"fmt"
"html/template"
"io"
"github.com/labstack/echo/v4"
)
type tmpl struct {
t *template.Template
}
var _ = fmt.Printf
func (t *tmpl) Render(w io.Writer, name string, data interface{}, c echo.Context) error {
return t.t.ExecuteTemplate(w, name, data)
}
func loadTemplates() (*tmpl, error) {
t, err := template.New("drmdb").ParseGlob("public/*.html")
return &tmpl{t}, err
}