提交 f7ab1fbc 编写于 作者: J Jo-Philipp Wich

libs/web: add export() to template namespace, allows templates to export...

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
上级 44cd848b
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册