= Reference: Templates =
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||
OpenWrt嵌入LUCI
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章
OpenWRT開發之——對C++的支持(解決庫依賴問題)
mrwangwang
2020-06-27 22:28:32
OpenWrt MVC架構 添加頁面
一笑释青春
2020-02-21 01:09:14
openwrt firmware分區
sunxiaohusunke
2018-09-01 03:10:35
uci 命令、shell接口、API接口
笑笑十年少
2018-08-23 21:05:45
Ubuntu16.04 openwrt源碼下載
笑笑十年少
2018-08-23 21:05:45
luci與頁面的數據交互
笑笑十年少
2018-08-23 21:05:44
luci調用linux命令和shell的接口函數
笑笑十年少
2018-08-23 21:05:44