1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-11-20 02:18:20 +01:00
antd-web-apps/blog/view.lua

27 lines
604 B
Lua
Raw Normal View History

2018-02-23 19:52:10 +01:00
local view = {}
view.html = function(name)
local path = BLOG_ROOT.."/view/"..name..".html"
local f = io.open(path, "rb")
if f then
echo(f:read("*all"))
f:close()
else
echo("Cannot find "..path)
end
end
view.render = function(action, data, sort)
view.html("top")
local path = BLOG_ROOT.."/view"
if action == "id" then
_G.dbmodel = data[0]
doscript(path.."/detail.ls")
else
_G.dbmodel = { data = data, order = sort }
doscript(path.."/entries.ls")
end
_G.dbmodel = nil
view.html("bot")
end
return view