Skip to content

Instantly share code, notes, and snippets.

@ninnemana
Created August 13, 2012 14:11
Show Gist options
  • Save ninnemana/3341096 to your computer and use it in GitHub Desktop.
Save ninnemana/3341096 to your computer and use it in GitHub Desktop.
Display Multiple HTML files
func (t Template) DisplayMultiple(templates []string) {
if t.Layout == "" {
t.Layout = "layout.html"
}
log.Println(templates)
if t.Bag == nil {
t.Bag = make(map[string]interface{})
}
templ := template.Must(template.ParseFiles(t.Layout))
for _, filename := range templates {
templ.ParseFiles(filename)
}
if err := templ.Execute(t.Writer, t.Bag); err != nil {
http.Error(t.Writer, err.Error(), http.StatusInternalServerError)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment