WebPageBegin/WebPageEnd (Declare a Web Page)

The WebPageBegin/WebPageEnd instructions are used to declare a web page that will be displayed when a request for the defined HTML page comes from an external source.

Syntax

WebPageBegin ( WebPageName, WebPageCmd )

HTTPOut ( "<p>html string to output" + variable + "additional string to output</p>" )

HTTPOut ( "<p>html string to output" + variable + "additional string to output</p>" )

WebPageEnd

Remarks

The WebPageBegin/WebPageEnd instructions enclose the HTTPOut instructions that comprise the text of the web page. The web page declaration must appear before the BeginProg instruction. Multiple web page declarations can be defined in the program.

When the WebPageName is requested from the datalogger, the datalogger will provide an HTML page comprised of the code in the HTTPOut instructions. This method allows a way for the datalogger to provide the most recent values for variables in an HTML format.

Parameters

WebPageName (Web Page Name)

The name for the HTML page created by the datalogger. The HTML file name must be enclosed in quotes. If this parameter is set to "default.html", the datalogger will replace the page it displays by default with the one defined in the web page declaration.

Type: String enclosed in quotes

WebPageCmd (Incoming Web Command)

A string that holds the incoming command from the web browser, which the datalogger will subsequently parse. The string needs to be sized large enough to accommodate any command that might be received.

Commands can be passed from the web page to the datalogger, which the datalogger will then parse and act upon (all commands after the "?" are parsed). Commands that are supported natively by the operating system are:

Command

Syntax

Description

HomePage command=homepage Goes to the datalogger’s home page. This can be used by bypass the default.htm that replaces the datalogger’s home page, if a default has been created.
SetValue command=SetValue&table=tablename&field=fieldname&value=value Sets a value in the Public or Status table. Tablename is the name of the table in the datalogger (Public or Status), fieldname is the variable in the table to set, and value is the value to set the variable to. To restrict access to setting values in the datalogger, SetValue must be used in conjunction with a user account with Read/Write access.
NewestRecord command=NewestRecord&table=tablename Retrieves the most recent record from a table in the datalogger. Tablename is the name of the table from which to retrieve the record.
TableDisplay command=TableDisplay&table=tablename&records=NumberRecords Displays the most recent X number of records from a data table. Tablename is the name of the table from which to display the records, and NumberRecords is an integer indicating the number of records to display.
Units command=tablename&units=true Displays the units, if defined, for the variables in a table. Tablename is the name of the table for which units should be displayed.
File command=File&file=FileName Displays a file. Filename is the file to be displayed.
File Run command=File&File=FileName&command=StartProgram Runs a program file loaded in the datalogger. Filename is the name of the program to run.
PakBusAddress command=PakBusAddress Returns the next PakBus address, equal to or greater than 100, that is not contained in the datalogger’s routing table or neighbor list.
Security security=securitycode

Unlocks security set in the datalogger. Securitycode is the code for the security level in the datalogger that you want to unlock (for example, http://192.168.1.23/security=12345).

If security is enabled in the datalogger, at least the lowest level of security (level 3) must be unlocked to access a web page. Level 2 must be unlocked to set a variable in the Public table, and level 1 just be unlocked to set a value in the Status table.

The datalogger is also capable of basic web authentication using the datalogger Account Manager. This is the preferred method of securing the datalogger when it is acting as an HTTP server.

StyleSheet command=stylesheet=filename.css Applies a cascading style sheet to NewestRecord and TableDisplay. Filename.css is the name of the style sheet to use.

Note that these commands also can be used directly in a URL to the datalogger without having a web page in the datalogger. For example, the following typed into a URL will set a variable in the datalogger:

http://192.168.4.14/?command=SetValue&table=public&field=SetPoint&value=70.2

Type: String Variable