Skip to content

Instantly share code, notes, and snippets.

@thePunderWoman
Created April 19, 2013 19:51
Show Gist options
  • Save thePunderWoman/5422776 to your computer and use it in GitHub Desktop.
Save thePunderWoman/5422776 to your computer and use it in GitHub Desktop.
func Index(w http.ResponseWriter, r *http.Request) {
tmpl := plate.NewTemplate(w)
tmpl.ParseFile("templates/index.html", false)
err := tmpl.Display(w)
if err != nil {
log.Println(err)
}
}
func NewTemplate(w http.ResponseWriter) *Template {
server := NewServer()
tmpl, err := GetTemplate()
if err != nil {
tmpl, err = server.Template(w)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return tmpl
}
}
return tmpl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment