Modular Software - Home PicLan-IP - Home

Part 4: Simple Dynamic Content

The first step to creating dynamic content is to include variable information within an otherwise static HTML page. A simple example of this would be to display the current local time as a part of an HTML page. While this is a simple example, it does illustrate the process of embedding MV/Basic application code within a web document.

Insertion Points

The first step is to create the HTML page with an HTML editor. At the point that you wish to include the current time, include the following string instead:
{T.VAR}
This element can be included as a paragraph by itself or embedded in the middle of a long paragraph. You can also include the insertion string within other non-changing text as in:
The time in California is {T.VAR}. Do you know where your children are!
In both of these examples, T.VAR is the name of a MV/Basic variable that will be used to store the printable time. Also, you can include the insertion point with any HTML formatting tags in effect. This allows you to insert elements with varying bold, italic, underlined, varying font sizes and styles.

Body Code

The value T.VAR is set by MV/Basic code that executes within the HTML page itself. To insert this executable code, you would add the following code to the bottom of the HTML document:
PicLan-IP/BASIC { }

T.VAR = OCONV(TIME(),'MTS')
It is important to understand that the executable MV/Basic code that you place in the HTML document will not be seen by the web user. The PicLan-IP web server will remove this code from the page that is transmitted over the internet.

The body code that you include should typically be placed at the end of the HTML page, although you can actually include it anywhere. You must also include the executable code in a "preformatted" paragraph and you must be sure to end each line as a "newline" instead of a "new paragraph". With many HTML editors, this will require that you press <shift><enter> to end lines. If you are unsure how your HTML editor behaves, you can always look at the saved HTML text to make sure that the included BASIC source code is saved as simple text lines without intervening HTML markup tags.

How the Body Code Gets Interpreted

It is important to understand how the embedded MV/Basic code is interpreted by the PicLan-IP web server. PicLan-IP does not implement a new scripting language for you to write. Instead, PicLan-IP melds the existing MV/Basic compiler and run-time environment with a full-function HTTP server. When your HTML page includes embedded MV/Basic source code, the PicLan-IP web server automatically creates a stand-alone MV/Basic subroutine and places your code within that subroutine. After some additional processing, this generated subroutine is compiled using the standard system BASIC or COMPILE verbs.

The magic here is that PicLan-IP is not providing you with a sub-set of the MultiValue environment, but the entire MultiValue toolkit without limitation. Your inserted code runs at full-speed with full native access to MultiValue data files and functions. You can open files, read items, call subroutines, execute TCL commands, SSELECT files, read indexes, and re-use components from your ASCII applications freely. Your full MultiValue skillset is freely usable on the web.

The steps to convert your HTML page into executing MV/Basic code are also fully automated. Whenever you save or change an HTML document, the PicLan-IP web server will automatically parse, compile, and catalog the generated code for that page. If you do not change the content of an HTML page, the PicLan-IP web server will use the previously compiled version without delay. The parse, compile, catalog sequence does add a delay in processing a page the first time that the page is accessed, but after the initial access, the embedded code runs at full-speed.

How the Insertion Points are Interpreted

The above example included a variable insertion point {T.VAR} that was computed by a single line of MV/Basic code. In this case, T.VAR referres to an MV/Basic variable that contained the desired display string. In actual use, you can insert more than simple MV/Basic variables into your HTML documents. The following is quite legal:
The current time is {OCONV(TIME(),'MTS')}.
In essence, you can include any MV/Basic expression that evaluates to a printable string.

1 2 3 4 5 6 7 8 9
Modular Software - Home PicLan-IP - Home