http.Error(w, err.String(), http.StatusInternalServerError)
return
}
- err = t.Execute(p, w)
+ err = t.Execute(w, p)
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerError)
}
p = &Page{Title: title}
}
t, _ := template.ParseFile("edit.html", nil)
- t.Execute(p, w)
+ t.Execute(w, p)
}
func viewHandler(w http.ResponseWriter, r *http.Request) {
title := r.URL.Path[lenPath:]
p, _ := loadPage(title)
t, _ := template.ParseFile("view.html", nil)
- t.Execute(p, w)
+ t.Execute(w, p)
}
func main() {
http.Error(w, err.String(), http.StatusInternalServerError)
return
}
- err = t.Execute(p, w)
+ err = t.Execute(w, p)
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerError)
}
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
t, _ := template.ParseFile(tmpl+".html", nil)
- t.Execute(p, w)
+ t.Execute(w, p)
}
func main() {
p = &Page{Title: title}
}
t, _ := template.ParseFile("edit.html", nil)
- t.Execute(p, w)
+ t.Execute(w, p)
}
</pre>
title := r.URL.Path[lenPath:]
p, _ := loadPage(title)
t, _ := template.ParseFile("view.html", nil)
- t.Execute(p, w)
+ t.Execute(w, p)
}
</pre>
func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
t, _ := template.ParseFile(tmpl+".html", nil)
- t.Execute(p, w)
+ t.Execute(w, p)
}
</pre>
http.Error(w, err.String(), http.StatusInternalServerError)
return
}
- err = t.Execute(p, w)
+ err = t.Execute(w, p)
if err != nil {
http.Error(w, err.String(), http.StatusInternalServerError)
}