Created
March 19, 2015 00:09
-
-
Save lettergram/90daeb82b9e8555083ab to your computer and use it in GitHub Desktop.
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
// Page struct, which will contain template | |
type Page struct { | |
Title string | |
Body template.HTML | |
UserData template.HTML | |
Bar template.HTML | |
} | |
// Loads a page for use | |
func loadPage(title string, r *http.Request) (*Page, error) { | |
filename, option, usr, bar := user.LoadUserInfo(title, r) | |
body, err := ioutil.ReadFile(filename) | |
if err != nil { | |
return nil, err | |
} | |
return &Page{Title: title, Body: template.HTML(body), UserData: (template.HTML(usr) + template.HTML(option)), Bar: template.HTML(bar)}, nil | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment