31
For example, if your script is named
myscript.lua
then the URL would be:
/cgi-bin/script.cgi?script=
myscript.lua
or
/cgi-bin/private/script.cgi?script=
myscript.lua
Of course, typing these URL’s directly into a browser would require the above to be preceded
with the IP address; however, these are the absolute paths from within the device itself and
therefore the paths that should be used for all links within the HTML.
The CGI executable
script.cgi
will search the standard pool of Lua scripts. Therefore, scripts
that create web pages will be intermixed with non-webpage scripts and the user may use the
standard upload command to store the script on the device.
Arguments to be passed to the script are also passed within the URL by adding a name/value pair
within the URL. Details on passing arguments to the script can be found in section 4.4.
4.2
ADDING A LINK TO THE C&H NAVIGATION MENU
The user can add links to the main navigation menu displayed on all C&H standard web pages
by simply creating a file named “web_navbar.lua” and adding links to this file. This file should
be uploaded to the standard script pool like any other script.
The navigation menu bar is an HTML table with each link in a separate row. To add a link,
“web_navbar.lua” must include the HTML to create a new row. The example in Figure 11
illustrates how to add two links to the navigation menu.
Figure 11 Example Adding Link to the Navigation Menu
print([[
<tr><td align=”left” bgcolor=”EFEFEF”>
<a href=”/cgi-bin/script.cgi?script=myscript.lua”>
My Page
</a>
</td></tr>
<tr><td align=”left” bgcolor=”EFEFEF”>
<a href=”/cgi-bin/script.cgi?script=myscript_2.lua”>
My Page #2
</a>
</td></tr>
]])