1
0
mirror of https://github.com/lxsang/antd-web-apps synced 2024-12-28 02:08:22 +01:00
antd-web-apps/blog/view.lua
Xuan Sang LE e88b5470cc add blog
2018-02-23 19:52:10 +01:00

27 lines
604 B
Lua

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