ribbit/page_data.go

41 lines
736 B
Go
Raw Normal View History

2019-01-13 14:22:29 +00:00
package main
import (
"fmt"
)
// pageData is stuff that changes per request
type pageData struct {
Site *SiteData
Title string
SubTitle string
Stylesheets []string
HeaderScripts []string
Scripts []string
FlashMessage string
FlashClass string
LoggedIn bool
IsAdmin bool
Menu []menuItem
BottomMenu []menuItem
session *pageSession
TemplateData interface{}
}
func (p *pageData) show(tmplName string) error {
for _, tmpl := range []string{
"htmlheader.html",
"header.html",
tmplName,
"footer.html",
"htmlfooter.html",
} {
if err := outputTemplate(tmpl, p, p.session.w); err != nil {
fmt.Printf("%s\n", err)
return err
}
}
return nil
}