NetBasic for Internet consists of a Net2000-compliant WEB Document
Management component (DOC.NLM) and sample scripts which are stored
in the SYS:NETBASIC/WEB subdirectory. In addition, an interface
component may be required for the WEB server you are using. The
interface component connects the WEB server's CGI interface to
the Net2000 architecture, and is usually named CGI2NMX.NLM. This
NLM is placed in the WEB server's CGI-BIN sub-directory.
NetBasic is a scripting language designed for the NetWare ®
environment, which allows the development of Basic language scripts
that run on the server platform. NetBasic ships with the core
OS, and is installed into the SYS:NETBASIC subdirectory, along
with a suite of utility scripts and example programs illustrating
the use of the language..
Also available from HiTecSoft Corp. is a Windows Integrated Development
Environment (IDE) which further simplifies the script development
process. Using the NetBasic IDE (referred to as Visual NetBasic),
scripts can be developed using a drag and drop facility on any
Windows or Windows 95 workstation..
HTML documents are ASCII files that are usually created using a standard text editor. Normally, these documents are very static in nature. That is, they are created, placed into the WEB server's document directory, and then served on request to a WEB browser. Using NetBasic's document management component (DOC.NLM), you can write BASIC language scripts which generate HTML documents on the fly. Although knowledge of HTML is not required to use the NetBasic Document Management component, some familiarity with it might be helpful, especially when creating complex documents. There are many resources available on the Internet which discuss HTML, if you would like more information. This document does not attempt to explain HTML, but instead illustrates how to use NetBasic's built-in DOC API set to create dynamic HTML documents..
Any of the Net2000 compliant component APIs are accessible, allowing
full access to the NetWare API including NetWare Directory Services
(NDS), Btrieve and others. For example, you could write a script
that produces a list of users on the network, and present that
list inside a combo box of an HTML document. Since the document
is created on-demand, the information it contains is always up
to date. Another example might be creating a dynamic sales report
by accessing an online corporate database..
Creating WEB pages with NetBasic is done by writing Basic scripts
which utilize the DOC component APIs to output HTML source code.
The output from the Basic script is written back to the WEB server,
which then routes the data back to the WEB browser. User-written
Basic scripts are placed in the SYS:NETBASIC/WEB subdirectory,
so they can be located and executed by the NetBasic interpreter.
A minimal script which will create a WEB page is shown below:.
Sub Main DOC:Heading("My First WEB Page") DOC:Body DOC:Print("Hello, WEB world!") End Sub
Every NetBasic script must have a subroutine called Main.
In the example above, three DOC APIs are called: DOC:Heading,
DOC:Body and DOC:Print. The DOC:Heading call
is optional, but recommended. It adds a title to the HTML document,
which is used when the browser creates a bookmark to the page.
The next call is DOC:Body, and it is
required to start the definition of the body portion of the HTML
document. Finally, DOC:Print is called
to write the string "Hello, WEB World" to the document.
To execute this sample, create a file in the SYS:NETBASIC/WEB
directory, and place the source code above it that file. Save
it with the name "TEST.BAS", and then open your WEB
browser, and enter the following URL: http://www.yourserver.com/netbasic/test.bas.
Of course, be sure to substitute the name of your WEB server
for the "www.yourserver.com" portion of the address..
Links to NetBasic scripts from static HTML documents can be accomplished by either adding a link reference to the document, or by creating a form with a single submit button. For example, to create a form with a single submit button that is linked to a NetBasic script, add the following HTML source to your document:.
<FORM METHOD=POST ACTION=/netbasic/test.bas>
<INPUT TYPE=SUBMIT VALUE="NetBasic for Internet">
</FORM>
This would add a button to the HTML document that, when pressed,
would cause the script called "test.bas" to be executed
on the server. Assuming TEST.BAS contained the sample code above,
the result would be a WEB page with the string "Hello, WEB
World" in the document window..