Luci Interface Description

Source: Internet
Author: User
Tags i18n lua

Luci.dispatcher

entry (Path, target, title, order) Create a new dispatching node and define common parameters. Parameters path:virtual path target:target function to call when dispatched. Title:destination node title order:destination node order value (optional) Return value: Dispatching tree node


Interface Description: Create a new distribution node and define the relevant parameters

Parameter description:

Path: The path to access, but the path is given as a string array, such as the path is written as follows "{" Sixing "," Advanced "," DDNS "}", then you can access in the browser "http://192.168.1.1/cgi-bin/ Luci/sixing/advanced/ddns "To access this script. And usually we want to add a script for the admin menu, then we need to write "{" admin "," first menu Name "," menu item Name "}" as follows, and the system will automatically generate the menu item in the corresponding menu. " For example, if you want to create a menu item under the "Network" menu, the first-level dish sole name can be written as ' network '. Note that this path is the path under the control directory under the MCV schema, and in the control directory is the node that defines the Luci menu, creating a framework for the entire Luci menu.

Target: The actual behavior of the call when the defined menu is displayed or distributed. The invocation target is divided into three types, namely:

1. Execute the specified method (Action)

2, visit the designated page (views)

3. Call the CBI Module

4. Call Alias (...). )

5. Call Arcombine (TRG1,TRG2)

The first can call the specified function directly, such as clicking on a menu item to restart the router directly, such as "Call (" Function_name ")", and then write a function named Function_name under the current LUA file can be called, Use this function to perform the corresponding action. The second one can access the specified page, such as "Template (" Myapp/mymodule ") to invoke the/usr/lib/lua/luci/view/myapp/mymodule.htm file. Note that this specifies the HTML page, which belongs to the scope of the display view, so the HTML path should be in view third, if you want to write the configuration page, call the CBI, such as "CBI (" Myapp/mymodule ")" Can call/usr/lib/ Lua/luci/model/cbi/myapp/mymodule.lua file now. In addition, CBI rendering can include additional parameters, such as the Help interface:
Entry ({"Sixing", "Advanced", "DDNS"}, CBI ("Sixing/ddns", {help_url= "Sixing/help/ddns"}), _ ("Dynamic DNS"), 11), where
{help_url= "Sixing/help/ddns"} is a connection to the Help interface, "Sixing/help/ddns" is the Help portal defined in the Help.lua file in the Controler directory, and is also a entry-defined entry.  The portal is also processed according to its own definition of the relevant content. Note that because the parameter is to be configured, the CGI must be used for the underlying database operation then this is the model category, so the corresponding LUA script will be placed in the model directory. Fourth, if you click on a menu, the corresponding action is another menu entry, then use alias to indicate another intersection path, such as Alias ("Sixing", "Advanced", "DDNS"), such as: entry ({"Sixing", " Advanced "}, alias (" Sixing "," Advanced "," DDNS "), _ (" advanced "), 50), indicates that the entry (" Sixing "," Advanced "," DDNS ") is the entry {" Sixing "," Advanced "} alias fifth, if Target has parameters and no parameters, then the two target will be combined to use combine, such as:
Entry ({"Sixing", "Advanced", "Routes", "Route"}, Arcombine (CBI ("Sixing/route_zone"), CBI ("Sixing/routes")), nil, 130) . Leaf = True, where Arcombine (CBI ("Sixing/route_zone"), CBI ("Sixing/routes") combines two target, based on whether the parameter input is automatically called,


Title: The name of the node defined, such as: entry ({"Sixing", "Advanced"}, alias ("Sixing", "Advanced", "DDNS"), _ ("advanced"), 50), where
_ ("Advanced") is the defined menu entry name,

_ () indicates that the entry for the menu name translation is build/i18n-scan.pl, not the Po folder path. This parameter is not required and can be emptied directly.


Order: The sequence in which the target nodes are displayed can be emptied




_ ()

No-op function used to mark translation entries for menu labels. This function does not actually translate the given argument it used by build/i18n-scan.pl to find translatable entrie S. Interface Description: When defining the title, use this function to specify that the entry for the translation is not PO, but build/i18n-scan.pl


alias (...) Create a redirect to another dispatching node. Parameters ...: Virtual path destination

Interface Description: Creates a different entry alias for the current portal. The entry alias is also given as an input parameter using a string array.

Entry ({"Sixing", "Advanced"}, alias ("Sixing", "Advanced", "DDNS"), _ ("advanced"), 50), then the alias is also used, the string parameter is given. arcombine   (TRG1, TRG2) Create a combined dispatching target for non argv and argv requests. Parameters trg1:overview target trg2:detail target

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.