summaryrefslogtreecommitdiff
path: root/tpls.go
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-08-29 22:37:05 +0200
committerKevin Chabowski <kevin@kch42.de>2013-08-29 22:37:05 +0200
commit61f137d2cc8ae0199c99493701023b4d862a34ad (patch)
tree5a77a1beb16cfd508486fabf6419f37fc348fc34 /tpls.go
parent8ecfe7a2fc61caf890e319e7a2f298b71dc90826 (diff)
downloadmailremind-61f137d2cc8ae0199c99493701023b4d862a34ad.tar.gz
mailremind-61f137d2cc8ae0199c99493701023b4d862a34ad.tar.bz2
mailremind-61f137d2cc8ae0199c99493701023b4d862a34ad.zip
Registering accounts is working
Diffstat (limited to 'tpls.go')
-rw-r--r--tpls.go28
1 files changed, 28 insertions, 0 deletions
diff --git a/tpls.go b/tpls.go
new file mode 100644
index 0000000..e7298fa
--- /dev/null
+++ b/tpls.go
@@ -0,0 +1,28 @@
+package main
+
+import (
+ "html/template"
+ "log"
+ "path"
+)
+
+func loadTpl(tplpath, name string) *template.Template {
+ tpl, err := template.ParseFiles(
+ path.Join(tplpath, "master.tpl"),
+ path.Join(tplpath, name+".tpl"))
+ if err != nil {
+ log.Fatalf("Could not load template \"%s\": %s", name, err)
+ }
+ return tpl
+}
+
+var tplRegister *template.Template
+
+func initTpls() {
+ tplpath, err := conf.GetString("paths", "tpls")
+ if err != nil {
+ log.Fatalf("Could not get paths.tpls config: %s", err)
+ }
+
+ tplRegister = loadTpl(tplpath, "register")
+}