Move templates
This commit is contained in:
parent
48d1997f4d
commit
d924b577d1
9 changed files with 24 additions and 1 deletions
13
LICENSE
Normal file
13
LICENSE
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
Version 2, December 2004
|
||||||
|
|
||||||
|
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
|
||||||
|
|
||||||
|
Everyone is permitted to copy and distribute verbatim or modified
|
||||||
|
copies of this license document, and changing it is allowed as long
|
||||||
|
as the name is changed.
|
||||||
|
|
||||||
|
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
12
template.go
12
template.go
|
@ -5,9 +5,19 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
TEMPLATE_DIR = "templates/"
|
||||||
|
)
|
||||||
|
|
||||||
func loadTemplate(w http.ResponseWriter, tmpl string, data interface{}) {
|
func loadTemplate(w http.ResponseWriter, tmpl string, data interface{}) {
|
||||||
// TODO: when finish devel conver to global:
|
// TODO: when finish devel conver to global:
|
||||||
var templates = template.Must(template.ParseFiles("header.html", "footer.html", "index.html", "about.html", "book.html", "search.html", "upload.html"))
|
var templates = template.Must(template.ParseFiles(TEMPLATE_DIR + "header.html",
|
||||||
|
TEMPLATE_DIR + "footer.html",
|
||||||
|
TEMPLATE_DIR + "index.html",
|
||||||
|
TEMPLATE_DIR + "about.html",
|
||||||
|
TEMPLATE_DIR + "book.html",
|
||||||
|
TEMPLATE_DIR + "search.html",
|
||||||
|
TEMPLATE_DIR + "upload.html"))
|
||||||
|
|
||||||
err := templates.ExecuteTemplate(w, tmpl+".html", data)
|
err := templates.ExecuteTemplate(w, tmpl+".html", data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Reference in a new issue