summaryrefslogtreecommitdiffhomepage
path: root/examples/ffluci/controller/public/index.lua
blob: 4498c77edfb1c7e98c4a706d1e18b189e5125f01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
-- This is a very simple example Hello World FFLuCI controller
-- See the other examples for more automated controllers

-- Initialise Lua module system
module(..., package.seeall)

-- This is the module dispatcher. It implements the last step of the
-- dispatching process.
function dispatcher(request)
	require("ffluci.template").render("header")
	print("<h2>Hello World!</h2>")
	for k,v in pairs(request) do
		print("<div>" .. k .. ": " .. v .. "</div>")
	end
	require("ffluci.template").render("footer")
end

-- The following part is optional it could be useful for menu generators
-- An example menu generator is implemented in the template "menu"

menu  = {	
	-- This is the menu item description
	descr = "Hello World",
	
	-- This is the order level of the menu entry (lowest goes first)
	order = 10,

	-- A list of menu entries in the form action => "description"
	entries      = {
		{action = "index", descr = "Hello World"},
	}
}