diff mod_register_web/mod_register_web.lua @ 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 5e1f7af23cf0
children c56baec031e8
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);