Created
August 13, 2012 14:11
-
-
Save ninnemana/3341096 to your computer and use it in GitHub Desktop.
Display Multiple HTML files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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