func Template(w http.ResponseWriter, r *http.Request, tmpl string, td *models.TemplateData) error {
	var tc map[string]*template.Template
	// get the template cache from the app config
	if app.UseCache {
		tc = app.TemplateCache
	} else {
		tc, _ = CreateTemplateCache(PathTemplates)
	}

	t, ok := tc[tmpl]
	if !ok {
		return errors.New("can't get template from cache")
	}

	buf := new(bytes.Buffer)

	_ = t.Execute(buf, AddDefaultData(td, r))

	_, err := buf.WriteTo(w)
	if err != nil {
		helpers.ServerError(w, err)
		return err
	}

	return nil
}
// Tamplate renders templates using html/template
Tamplate renders templates using html/template
// Tamplate renders templates using html / template
func Template(w http.ResponseWriter, r *http.Request, tmpl string, td *models.TemplateData) error {
	var tc map[string]*template.Template
	if app.UseCache {
		tc = app.TemplateCache
	} else {
		tc, _ = CreateTemplateCache(PathTemplates)
	}
	t, ok := tc[tmpl]
	if !ok {
		return errors.New("can't get template from cache")
	}
	buf := new(bytes.Buffer)
	_ = t.Execute(buf, AddDefaultData(td, r))
	_, err := buf.WriteTo(w)
	if err != nil {
		helpers.ServerError(w, err)
		return err
	}
	return nil
}
func Template ( w http . ResponseWriter , r * http . Request , tmpl string , td * models . TemplateData ) error { var tc map [ string ] * template . Template if app . UseCache { tc = app . TemplateCache } else { tc , _ = CreateTemplateCache ( PathTemplates ) } t , ok := tc [ tmpl ] if ! ok { return errors . New ( " " ) } buf := new ( bytes . Buffer ) _ = t . Execute ( buf , AddDefaultData ( td , r ) ) _ , err := buf . WriteTo ( w ) if err != nil { helpers . ServerError ( w , err ) return err } return nil }
Tamplate renders templates using html/template
Tamplate renders templates using html / template
// get the template cache from the app config