changeset 1572:1aa894db3585

mod_register_web: Add option for specifying path to templates
author Kim Alvefur <zash@zash.se>
date Wed, 19 Nov 2014 10:19:51 +0100
parents eed7db9f3157
children 0d8cc6971cdb
files mod_register_web/mod_register_web.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_register_web/mod_register_web.lua	Tue Nov 18 13:59:39 2014 +0100
+++ b/mod_register_web/mod_register_web.lua	Wed Nov 19 10:19:51 2014 +0100
@@ -12,13 +12,14 @@
 	phone = true; url = true; date = true;
 }
 
+local template_path = module:get_option_string("register_web_template", "templates");
 function template(data)
 	-- Like util.template, but deals with plain text
 	return { apply = function(values) return (data:gsub("{([^}]+)}", values)); end }
 end
 
 local function get_template(name)
-	local fh = assert(module:load_resource("templates"..path_sep..name..".html"));
+	local fh = assert(module:load_resource(template_path..path_sep..name..".html"));
 	local data = assert(fh:read("*a"));
 	fh:close();
 	return template(data);