summaryrefslogtreecommitdiffhomepage
path: root/documentation/Templates.md
blob: 6affd7fcf67846899b72090b000b1e6c3cda0683 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
LuCI has a simple regex based template processor which parses HTML-files to Lua functions and allows to store precompiled template files.
The simplest form of a template is just an ordinary HTML-file. It will be printed out to the user as is.

In LuCI every template is an object with an own scope. It can therefore be instanciated and each instance can has a different scope. As every template processor. LuCI supports several special markups. Those are enclosed in *<% %>-Tags*.

By adding a *-_' right after the opening '''<%''' every whitespace before the markup will be stripped. Adding a '''-''' right before the closing '_%>* will equivalently strip every whitespace behind the markup.

<<BR>>


# Builtin functions and markups
## Including Lua code
*Markup:*
	
	<% code %>
	


## Writing variables and function values
*Syntax:*
	
	<% write (value) %>
	

*Short-Markup:*
	
	<%=value%>
	

## Including templates
*Syntax:*
	
	<% include (templatename) %>
	

*Short-Markup:*
	
	<%+templatename%>
	


## Translating
*Syntax:*
	
	<%= translate("Text to translate") %>
	


*Short-Markup:*
	
	<%:Text to translate%>
	


## Commenting
*Markup:*
	
	<%# comment %>
	

# Builtin constants
||*Name_'||'_Value*||
||REQUEST_URI||The current URL (without server part)||
||controller||Path to the Luci main dispatcher||
||resource||Path to the resource directory||
||media||Path to the active theme directory||