4498c77edfb1c7e98c4a706d1e18b189e5125f01
[project/luci.git] / examples / ffluci / controller / public / index.lua
1 -- This is a very simple example Hello World FFLuCI controller
2 -- See the other examples for more automated controllers
3
4 -- Initialise Lua module system
5 module(..., package.seeall)
6
7 -- This is the module dispatcher. It implements the last step of the
8 -- dispatching process.
9 function dispatcher(request)
10 require("ffluci.template").render("header")
11 print("<h2>Hello World!</h2>")
12 for k,v in pairs(request) do
13 print("<div>" .. k .. ": " .. v .. "</div>")
14 end
15 require("ffluci.template").render("footer")
16 end
17
18 -- The following part is optional it could be useful for menu generators
19 -- An example menu generator is implemented in the template "menu"
20
21 menu = {
22 -- This is the menu item description
23 descr = "Hello World",
24
25 -- This is the order level of the menu entry (lowest goes first)
26 order = 10,
27
28 -- A list of menu entries in the form action => "description"
29 entries = {
30 {action = "index", descr = "Hello World"},
31 }
32 }