Answer the question
In order to leave comments, you need to log in
Golang how to disable escape in html/template?
Hello. I wrote a function to load html
func Views(templateName string, l map[string]string, p map[string]string, w http.ResponseWriter, r *http.Request) {
result := strings.Split(templateName, ";")
var htm string
for i := range result {
bs, err := ioutil.ReadFile("kontrollers/html/" + result[i])
if err != nil {
Code404(w, r)
ViewsErr("Страница не найдена! Внимание! Тревога! Код 404 - всем соблюдать панику!", w)
return
}
htm = htm + string(bs)
}
t := template.New("html")
t.Parse(htm)
w.Header().Set("Content-Type", "text/html")
t.Execute(w, map[string]map[string]string{
"local": l,
"game": p,
})
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question