From 61f137d2cc8ae0199c99493701023b4d862a34ad Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Thu, 29 Aug 2013 22:37:05 +0200 Subject: Registering accounts is working --- tpls.go | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tpls.go (limited to 'tpls.go') 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") +} -- cgit v1.2.3-70-g09d2