libs/web: add export() to template namespace, allows templates to export symbols to the calling view namespace, this is useful for includes defining shared procedures or variables

This commit is contained in:
Jo-Philipp Wich 2010-10-15 16:12:07 +00:00
parent 44cd848b28
commit f7ab1fbc56

View file

@ -237,6 +237,7 @@ function dispatch(request)
write = luci.http.write;
include = function(name) tpl.Template(name):render(getfenv(2)) end;
translate = function(...) return require("luci.i18n").translate(...) end;
export = function(k, v) if tpl.context.viewns[k] == nil then tpl.context.viewns[k] = v end end;
striptags = util.striptags;
pcdata = util.pcdata;
media = media;