Novell is now a part of Micro Focus

Dynamic Web Pages With IntranetWare: Dynamic Web Pages With IntranetWare

Articles and Tips:

Terry L. Jeffress

01 May 1997


After you have configured your IntranetWare network as an intranet andhave published HyperText Markup Language (HTML) documents, you may thinkthat your work is completed and you can now relax. If you stop there, however,you will not be taking full advantage of the IntranetWare platform. Forexample, to make your HTML documents more useful and interesting, you canuse the Novell Web Server 3.0 component of IntranetWare to create dynamicHTML documents. When a user requests a dynamic HTML document, Novell WebServer 3.0 generates an entire dynamic HTML document or a dynamic elementin an HTML document, according to your specifications.

With Novell Web Server 3.0, you can create dynamic HTML documents usingthe following:

  • Server Side Include Commands. A Server Side Include (SSI) command defines text you want to include in an HTML document or a function you want Novell Web Server 3.0 to perform. When a user requests an HTML document that contains an SSI command, Novell Web Server 3.0 replaces the command with text or performs the specified function.

  • NetBasic Scripts. Written in the BASIC programming language, a NetBasic script runs on an IntranetWare server and can produce a dynamic HTML document or process an interactive HTML document such as an online form. A NetBasic script can also access information on your IntranetWare server, such as information in the IntranetWare file system or the Novell Directory Services (NDS) database.

  • Perl Scripts. A Perl script also runs on an IntranetWare server to produce an entire dynamic HTML document or to process an online form. Like a NetBasic script, a Perl script can access information in the IntranetWare file system. Unlike a NetBasic script, however, a Perl script cannot access the NDS database. Novell Web Server 3.0 includes a Perl 5 script interpreter.

  • JavaScript Scripts. A JavaScript script is interpreted by a World-Wide Web (WWW) browser rather than by an IntranetWare server. To create a dynamic element in an HTML document, you must create a JavaScript script in the document itself.

  • Java Applets. Java is an object-oriented programming language designed specifically for the WWW. You can write small Java applications calledappletsto create a dynamic element in an HTML document. When a user requests an HTML document that calls for a Java applet, the user's browser downloads the applet from Novell Web Server 3.0 and runs this applet on the user's workstation, displaying the results in the user's browser.

  • NetWare Loadable Modules (NLMs). A custom NLM can produce an entire dynamic HTML document or a dynamic element in an HTML document. This type of NLM runs on the same IntranetWare server as Novell Web Server 3.0.

This article is the first part of a two-part series that explains howto use Novell Web Server 3.0 to publish dynamic HTML documents: This articleexplains how to use SSI commands and NetBasic scripts. The next articlediscusses Perl scripts, JavaScript scripts, and Java applets. (The articleswill not discuss writing custom NLMs since this task is beyond the scopeof these articles.)

WHAT CAN SSI COMMANDS DO FOR YOU?

By including an SSI command in an HTML document, you can instruct NovellWeb Server 3.0 to replace the command with a dynamic element, such as adate, or to perform some other function, such as appending a line of textto the document. When a user requests an HTML document, Novell Web Server3.0 usually sends the document exactly as it is stored in the virtual WWWserver's document tree. (Adocument treeis the directory structureof the virtual WWW server's root directory. For information about the NovellWeb Server 3.0 directory structure, see "Electronic Publishing with IntranetWare: Just Another Branch on Your NDS Tree," NetWare Connection, Mar. 1997, pp. 6[shy ]18.)

In contrast, when a user requests an HTML document that contains an SSIcommand, Novell Web Server 3.0 interprets--orparses--the commandand then replaces it with text or performs the specified function. For example,if you included the FLASTMOD command in an HTML document, Novell Web Server3.0 would replace this command with the date the document was last modified.

Writing SSI Commands

To include an SSI command in an HTML document, you must enter the commandas an HTML comment and place this comment at the point in the document thatyou want Novell Web Server 3.0 to execute the command. An SSI command mustbe inserted as an HTML comment because the command is not displayed by auser's browser: If for some reason Novell Web Server 3.0 does not parsethe SSI command, a user does not see the unparsed command.

You must use the following syntax for an HTML comment:

<!--comment text-->

To write an SSI command, you must replacecomment textwith apound sign (#), followed by the command itself and any required parameters,as shown below.

<!--command parameter=>value<-->

The pound sign tells Novell Web Server 3.0 to parse the HTML commentas an SSI command. If you include both SSI commands and regular HTML commentsin the same HTML document, you cannot use a pound sign as the first characterin the text of regular HTML comments. If the first character of the commenttext is a pound sign, Novell Web Server 3.0 tries to parse the SSI command,and users will probably see an error message.

Novell Web Server 3.0 supports the SSI commands listed in "SSICommands for Novell Web Server 3.0." Because each SSI command hasits own set of parameters, the parameters you include in these commandsvary, depending on the command you use. (For more information about SSIcommands and valid parameters, consult the online documentation includedwith Novell Web Server 3.0.)

SSI commands and most of their parameters are not case sensitive. However,if a parameter's value is an environment variable, you must type the parameterin uppercase letters. (Environment variablesstore information suchas the current date and time and the directory path of the current HTMLdocument.) Four SSI commands--APPEND, CALC, ECHO, and IF--use environmentvariables. For example, the following ECHO command uses an environment variable:

<!--#ECHO VAR=>DATE_LOCAL<-->

If you use the ECHO command, Novell Web Server 3.0 replaces the HTMLcomment with the value indicated by the environment variable you use. Inthe previous example, Novell Web Server 3.0 would replace the HTML commentwith the current date and time, resulting in a line similar to the following:

Thursday, 27-Feb-1997 10:50:16 MDT

ENABLING SSI PARSING

Because parsing SSI commands requires additional processing, by defaultNovell Web Server 3.0 does not review HTML documents, finding and parsingSSI commands. To instruct Novell Web Server 3.0 to parse SSI commands ina particular HTML document, you must complete two tasks:

  • You must save the HTML document with the .SSI extension.

  • You must set the Enable Includes option for the directory in which the HTML document resides.

Naming HTML Documents That Contain SSI Commands

You can assign an HTML document that contains SSI commands any validfilename, but this filename must include the .SSI extension. When a userrequests an HTML document, Novell Web Server 3.0 identifies the filenameextension and then finds this extension in a table that maps filename extensionsto a Multipurpose Internet Mail Extensions (MIME) content type.

After identifying an HTML document's content type, Novell Web Server3.0 can process the document. For example, HTML documents with the .HTMor .HTML extension are mapped to the"text/html"MIME contenttype. Novell Web Server 3.0 sends these HTML documents directly to the userwho requested them without parsing any commands in the documents.

HTML documents with the .SSI extension are mapped to the"text/x-server-parsed-html"MIME content type. When a user requests an HTML document with the .SSI extension,Novell Web Server 3.0 parses the SSI commands in the document before sendingthis document to the user. (You can edit the MIME content-type table soNovell Web Server 3.0 parses SSI commands in HTML documents that have otherextensions. See "Changing the SSI MIME ContentType.")

Setting the Enable Includes Option

Novell Web Server 3.0 parses commands in HTML documents with the .SSIextension only if these documents reside in a directory for which you haveset the Enable Includes option. If you do not set the Enable Includes optionfor a directory, Novell Web Server 3.0 sends all of the HTML documents inthat directory--including documents with the .SSI extension--to a user withoutparsing the SSI commands. If a user requested an HTML document that containsSSI commands from a directory for which the Enable Includes option had notbeen set, the user would see only blank spaces in the places you wantedSSI-generated data to appear.

When you install Novell Web Server 3.0, the installation program createsan SSI directory (SYS:\WEB\DOCS\SSI) and sets the Enable Includes optionfor this directory. If you do not want to set the Enable Includes optionfor other directories, you can save any HTML document that contains SSIcommands in this directory. Users can then access HTML documents directlyfrom the SSI directory. You can also create hypertext links in other HTMLdocuments that point to the documents in the SSI directory.

To set the Enable Includes option for a directory, you would completethe following steps:

  1. Launch the Web Manager (WEBMGR) utility. The WEBMGR.EXE file is located in the SYS:\PUBLIC directory of the IntranetWare server on which you installed Novell Web Server 3.0.

  2. Choose the Select Server option from the File menu.

  3. Select the directory that contains the WEB.CFG file. By default, this file is located in the SYS:\ETC directory.

  4. Select a virtual server from the Virtual Server list, and click OK.

  5. Select the Directories tab. (See Figure 1.)

    Figure 1: Using the Web Manager utility, you can configure Novell Web Server 3.0 to parse SSI commands in HTML documents that are located in particular directories.

  6. In the Existing Directories list, select the directory for which you want to set the Enable Includes option.

  7. In the Options field, check the Enable Includes box.

  8. Click Change.

  9. Click OK.

  10. Click Save and Restart.

  11. Type the Novell Web Server 3.0 password, and click OK.

Using SSI Commands to Display a Hit Counter and the Last ModificationDate

After you have ensured that Novell Web Server 3.0 will process SSI commands,you can use these commands to add dynamic elements to an HTML document.For example, a WWW page could announce that you were the 12,427th user tovisit the page and that the HTML document you were viewing was last modifiedon 28 March 1997 at 11:47 a.m. eastern standard time. You can use SSI commandsto display this information about your HTML documents.

To include a hit counter in an HTML document, you would add a line similarto the following at the point in the HTML document that you wanted the hitcounter to appear:

You are visitor <!--#COUNT file=>index.cnt<-->.

In this command, index.cnt is a text file that stores the current hitcount. If the index.cnt file did not exist, Novell Web Server 3.0 wouldcreate this file and place it in the directory that contains the HTML documentwith the COUNT command. After Novell Web Server 3.0 ensured that the fileexists, Novell Web Server 3.0 would open this file, increment the hit countby one, and replace the SSI command with the current hit count.

To view the number of times a WWW page has been accessed without incrementingthe hit count, you would add a line similar to the following in an HTMLdocument:

INDEX.HTM has been accessed <!--#INCLUDE file=>index.cnt<--> times.

Each counter file can contain only one number. If you wanted to use ahit counter for more than one WWW page, you would have to assign each pagea different counter file.

You can assign counter files any valid filename. Although the file inthe previous example uses the .CNT extension, this extension is not required.

To display the date an HTML document was last modified, you would adda line similar to either of the following:

  Last modified: <!--#ECHO VAR=<LAST_MODIFIED>-->
  Last modified: <!--#FLASTMOD file=<INDEX.SSI>-->

Both of these commands would display information similar to the following:

Last modified: Friday, 07-Apr-1997 15:59:32 MDT

If you use the FLASTMOD command, you can use the CONFIG command to formathow Novell Web Server 3.0 displays the date. For example, you could adda line similar to the following before the FLASTMOD command:

<!--#CONFIG TIMEFMT=>%B %d, %Y<-->

Novell Web Server 3.0 does not replace the CONFIG command with any text.Instead, Novell Web Server 3.0 uses the value of the TIMEFMT parameter asa template for displaying the date specified in the FLASTMOD command. Thisvalue is called afield descriptorand is based on UNIX date formatcommands. (See "Field Descriptors for NovellWeb Server 3.0.") Novell Web Server 3.0 would use the CONFIG commandin the previous example to replace the FLASTMOD command with a date displayedin the following format:

April 07, 1997
Using SSI Commands to Process an Online Form

You can also use SSI commands to process basic online forms. For example,you could use SSI commands and an online form to create a guest book foryour WWW site. The following example illustrates how to create such a guestbook, using five files:

  • FORM.HTM, an online form in which a user can input data

  • SIGN.SSI, an HTML document that uses SSI commands to process data from the online form

  • GCOUNT.CNT, a counter file that counts the number of users who visit your WWW site

  • GLIST.HTM, a text file that stores the data from the online form

  • GUEST.SSI, an optional HTML document that lists users who completed the online form

Figure 2 shows how these files interact.The FORM.HTM file is a regular HTML document that includes a link to theSIGN.SSI file. The FORM.HTM file does not contain any SSI commands; rather,this file's only function is to collect a user's data and send this datato the SIGN.SSI file. The SIGN.SSI file actually processes the data.

Figure 2: Using SSI commands, Novell Web Server 3.0 can process basic online forms.

Because a user's data is processed through SSI commands, the FORM tagin the FORM.HTM file must include the METHOD=GET parameter. (A FORM tagis necessary to begin and end an online form.) If you use this parameter,the user's browser sends the user's data to the next file as part of theURL. For example, if a user entered the name"Bob"and clickedthe Sign link, the user's browser would request the SIGN.SSI file with aURL similar to the following:

http://www.sitename.com/sign.ssi?NAME=Bob

If an item follows a question mark in a URL, that item is processed asan environment variable. Thus, NAME is an environment variable in this example.

The SIGN.SSI file uses SSI commands to add the user's data to a textfile. For example, to add the value of the NAME environment variable tothe GLIST.HTM file, the SIGN.SSI file would contain a line similar to thefollowing:

<!--#APPEND FILE=<GLIST.HTM> LINE=<P><NAME>-->

If the NAME environment variable were set to"Bob,"this commandwould append a line containing""P"Bob"to the GLIST.HTMfile.

The LINE parameter can contain other text in addition to environmentvariables. In the previous example, the parameter adds the HTML paragraphtag (>P>) before the user's name. This tag ensures that each nameis included on a separate line in the GLIST.HTM file, making the list ofnames easy to read.

The SIGN.SSI file also contains a COUNT command that keeps a runningcount of names that have been added to the GLIST.HTM file. In addition,the SIGN.SSI file includes a link to the GUESTS.SSI file, which uses INCLUDEcommands to display the running count and the complete list of users. (Youcan download the actual five files I used for this example from ftp://ftp.novell.com/pub/nwc-online/may97.)

WHAT CAN NETBASIC SCRIPTS DO FOR YOU?

SSI commands are processed by Novell Web Server 3.0 and generate dynamicelements of otherwise static HTML documents. NetBasic scripts, on the otherhand, are BASIC-language programs that run on your IntranetWare server andcan generate entire dynamic HTML documents. (NetBasic scripts can do muchmore than generate dynamic HTML documents, but this article discusses onlythis NetBasic feature.)

NetBasic is a scripting language and a set of language-interpreter NLMsthat were developed by High Technology Software Corp. (HiTecSoft). Novellpurchased a license from HiTecSoft that enables Novell to include NetBasicwith NetWare 4.11 and IntranetWare.

When you install IntranetWare, the installation program installs theNetBasic NLMs in the SYS:SYSTEM directory. Then when you install NovellWeb Server 3.0, the installation pro-gram creates a WEB subdirectory inthe SYS:NETBASIC directory and copies some sample scripts to this subdirectory.

As a security precaution, Novell Web Server 3.0 can access only the NetBasicscripts that are stored in the SYS:NETBASIC/WEB subdirectory. As a result,you must store all of your NetBasic scripts in this subdirectory. You canassign any valid filename to a NetBasic script, as long as that filenameincludes the .BAS extension.

In addition to generating dynamic HTML documents, a NetBasic script canaccess nearly any server resource, including the IntranetWare file systemand the NDS database. Thus, you could write a NetBasic script to help youmanage your network from a browser. For example, you could write a NetBasicscript that would list all of the users connected to your IntranetWare serverand enable you to use your browser to send a broadcast message to one orall of these users.

Although NetBasic scripts can be extremely useful, you may not be ableto use all of the NetBasic interpreter's capabilities unless you have experiencein writing computer programs. In fact, with the exception of SSI commands,most methods of creating dynamic HTML documents require some programmingexperience.

Understanding NetBasic

Before you begin writing NetBasic scripts, you should understand howa request from a user's browser calls a NetBasic script and how Novell WebServer 3.0 processes this request.

NetBasic scripts are processed by the NetBasic interpreter (NETBASIC.NLM),a Net2000-compliant NLM that communicates with other server components usingthe NetWare Module Extension (NMX) engine. Novell Web Server 3.0, on theother hand, supports the Common Gateway Interface (CGI) standard, whichdefines how WWW servers and external applications communicate. (For moreinformation about CGI, see "CGI Solutions forNovell Web Server 3.0.")

To translate CGI communications from Novell Web Server 3.0 into NMX messagesthe NetBasic interpreter understands, an additional module, the CGI-to-NMXinterface (CGI2NMX.NLM), sits between Novell Web Server 3.0 and the NetBasicinterpreter. The CGI-to-NMX interface also passes the dynamic HTML documentsgenerated by a NetBasic script back to Novell Web Server 3.0.

Novell Web Server 3.0 runs a NetBasic script only when a user requeststhe script. A user can request a NetBasic script by entering the requestdirectly into his or her browser or by clicking on a hypertext link thatrequests the NetBasic script. In either case, the browser would requesta URL similar to the following:

http://www.sitename.com/netbasic/script.bas

Novell Web Server 3.0 would then have the NetBasic interpreter run thescript named script.bas. In the default server resources map (SRM.CFG),each virtual WWW server is configured to pass any requests that have /netbasic/after the site name to the CGI-to-NMX interface. (See Figure 3.)

Figure 3: When a user's WWW browser requests a NetBasic script, Novell Web Server 3.0 must pass the request through the CGI-to-NMX interface. NetBasic then runs the script and sends the HTML document back through the CGI-to-NMX interface.

If the CGI-to-NMX interface is not loaded, Novell Web Server 3.0 loadsCGI2NMX.NLM and then sends the request to this interface. The CGI-to-NMXinterface, in turn, sends an NMX command to the NetBasic interpreter.

If the NetBasic interpreter is not loaded, the CGI-to-NMX interface loadsNETBASIC.NLM. The NetBasic interpreter then loads and executes the script,sending the resulting dynamic HTML document through the CGI-to-NMX interfaceand back to Novell Web Server 3.0, which passes the document to the user'sbrowser.

Creating WWW Pages with NetBasic

Like HTML documents, NetBasic scripts are ASCII text files, which you can create using a text editor or word processor. A NetBasic script consistsof one or more subroutines, one of which must be called Main. When runninga script, the NetBasic interpreter runs the Main subroutine first. To createWWW pages with NetBasic, you must write commands from the NetBasic DOC class. The script uses three of these commands.

  sub main

    DOC:Heading("A NetBasic Script")

    DOC:Body

    DOC:Print("Hello, Web clients!")

   end sub

If a user requested this NetBasic script, the NetBasic interpreter wouldrun the script and generate the following dynamic HTML document:

  <HTML>
   <HEAD><TITLE>
   A NetBasic Script

   </TITLE></HEAD>
   <BODY>
   Hello, Web clients!</BODY></HTML>

As you can see, the DOC:Heading command would add the HEAD and TITLEtags to the HTML document, the DOC:Body command would add the BODY tag tothe document, and the DOC:Print command would add a specific line of textto the document. At the end of the script, NetBasic would automaticallyappend the /BODY and /HTML tags to the HTML document. (For more informationabout the DOC class and the other command classes the NetBasic interpretersupports, consult the online documentation included with Novell Web Server3.0.)

If you need to write long or complex NetBasic scripts, you might wantto use HiTecSoft's NetBasic WebPro, which includes a Windows-based integrateddevelopment environment (IDE) for writing NetBasic scripts. This IDE, whichruns on any Windows 95 or Windows NT 4.0 workstation, allows you to createNetBasic scripts using drag-and-drop editing and provides extensive onlinehelp. (For more information about NetBasic WebPro, call 1-888-970-1025 or1-602-970-1025. You can also visit HiTecSoft's WWW site at http://www.hitecsoft.com.)

Creating Hypertext Links to a NetBasic Script

After you have written a NetBasic script, you should provide a way forusers to request the script and view the resulting dynamic HTML document.The easiest way to provide access to a NetBasic script is to create a hypertextlink to the script from an HTML document such as your WWW home page. Tocreate a hypertext link in a static HTML document, you would add a linesimilar to the following to the document:

<a href="/netbasic/script.bas">LaunchNetBasic Script</a>

When viewing a static HTML document that contains this line, a user wouldsee"Launch NetBasic Script"as a hypertext link. If a user clickedthe hypertext link, Novell Web Server 3.0 would tell the NetBasic interpreterto run the script. The user would then see the dynamic HTML document generatedby script.bas.

You can also link a NetBasic script to a hypertext button. To createsuch a button, you would add lines similar to the following to a staticHTML document:

  <form action="/netbasic/script.bas">
   <input type=submit value="Launch NetBasic Script">
   </form>

When viewing a static HTML document that contains these lines, a userwould see a hypertext button labeled"Launch NetBasic Script."If the user clicked the hypertext button, Novell Web Server 3.0 would tellthe NetBasic interpreter to run the script. The user would then see thedynamic HTML document generated by script.bas.

Of course, you can also write a NetBasic script that generates a dynamicHTML document with hypertext links or buttons to other NetBasic scripts.For example, the NetBasic script shown in "A Sample NetBasic Script" would generate a dynamic HTML documentwith a hypertext link to script1.bas and a hypertext button linked to script2.bas.

CONCLUSION

With Novell Web Server 3.0, you can create entire dynamic HTML documentsor HTML documents with dynamic elements. Using SSI commands, you can includedynamic elements such as hit counters and last modification dates, or youcan process online forms. Using NetBasic, you can write BASIC-language scriptsthat generate entire dynamic HTML documents. You can also process onlineforms and access the IntranetWare file system or the NDS database with NetBasic.

You can download Novell Web Server 3.0 from Novell's WWW site (http://www.novell.com/intranetware/products/novell_web_server).

Terry L. Jeffress works for Niche Associates, an agency that specializesin technical writing and editing.

NetWare Connection, May 1997, pp.6[shy ]20

CGI Solutions for Novell Web Server 3.0

Although the Sever Side Include (SSI) commands that Novell Web Server 3.0 supports allow you to include dynamic elements in your HyperText Markup Language (HTML) documents, these commands have some limitations: For example, SSI commands cannot access a database application through a World-Wide Web (WWW) browser. To provide you with more advanced tools to build your intranet, Novell Web Server 3.0 enables you to write customized applications and scripts that can interact with other IntranetWare processes and generate dynamic HTML documents.

In contrast to SSI commands, which are built-in functions of Novell Web Server 3.0, the customized applications and scripts that interact with Novell Web Server 3.0 run as separate functions on an IntranetWare server or on another type of server, such as a UNIX server. To communicate with these applications and scripts, Novell Web Server 3.0 uses the Common Gateway Interface (CGI) standard, which defines how WWW servers should communicate with external applications. This standard also includes environment variables, which these applications can use to receive data, such as a user's IP address, from Novell Web Server 3.0. (For more information about CGI, see http://hoohoo.ncsa.uiuc.edu/cgi/interface.html.)

Novell Web Server 3.0 supports two versions of CGI: Remote Common Gateway Interface (RCGI) and Local Common Gateway Interface (LCGI).

USING RCGI APPLICATIONS WITH NOVELL WEB SERVER 3.0

RCGI applications can run on multiple platforms, including IntranetWare. For example, using RCGI, Novell Web Server 3.0 can interact with a UNIX server running a CGI application, which returns the results to a user. As a result, you can use existing CGI applications to generate dynamic HTML documents, including the many publicly-available CGI applications for UNIX.

To enable Novell Web Server 3.0 to execute an RCGI application, you must run a program called the RCGI daemon on the remote host. You must also configure the RCGI daemon to "listen" to a specific TCP port, and you must configure Novell Web Server 3.0 to direct requests for an RCGI application to this port.

Novell Web Server 3.0 can also use RCGI to communicate with RCGI applications designed to run on an IntranetWare server. Even if both an RCGI application and Novell Web Server 3.0 are running on the same IntranetWare server, Novell Web Server 3.0 must communicate with the application through a TCP socket. This configuration creates a virtual connection between Novell Web Server 3.0 and the RCGI application.

USING LCGI APPLICATIONS WITH NOVELL WEB SERVER 3.0

LCGI applications are NetWare Loadable Modules (NLMs) that execute on the same IntranetWare server as Novell Web Server 3.0. As a result, LCGI applications do not use TCP sockets and run more quickly than RCGI applications. However, because LCGI applications are NLMs, they are not portable to other platforms.

In addition, LCGI applications can use a process called LCGI chaining to call other applications that are running on the IntranetWare server. For example, Novell Web Server 3.0 sends requests to run NetBasic scripts to the CGI2NMX NLM--an LCGI application that calls the NetBasic interpreter to complete a user's request.

Novell realized that writing your own customized RCGI applications or LCGI-compliant NLMs could be time consuming. As a result, Novell Web Server 3.0 includes two script-based LCGI applications: a NetBasic interpreter and a Perl 5 interpreter. Instead of writing an LCGI application, you can write a script that instructs Novell Web Server 3.0 to perform the desired function. When a user requests an HTML document that contains a script, Novell Web Server 3.0 passes the script to the appropriate script interpreter.

With the NetBasic interpreter, BASIC-language scripts can interact with Novell Web Server 3.0. NetBasic also includes an application programming interface (API) that enables NetBasic scripts to interact with the IntranetWare operating system, file system, and Novell Directory Services (NDS) database. The Perl 5 interpreter provides similar capabilities as the NetBasic interpreter, except that the Perl 5 interpreter cannot access the NDS database.

SSI Commands for Novell Web Server 3.0

Novell Web Server 3.0 supports the following Server Side Include (SSI) commands:


COMMAND
FUNCTION

APPEND

Appends a line of text to a text file

BREAK

Immediately ends the HyperText Markup Language (HTML) document

CALC

Performs mathematical calculations

CONFIG

Formats the results of the FSIZE and FLASTMOD commands and determines the SSI error message displayed and action taken when an error occurs

COUNT

Prints the number of times an HTML document has been accessed

ECHO

Displays the contents of a variable

EXEC

Executes a NetWare Loadable Module (NLM) on the local server

FLASTMOD

Displays the date on which an HTML document was last modified

FSIZE

Displays the size of an HTML document

GOTO

Moves to a location in an HTML document (The location is set by the LABEL command.)

IF

Performs an operation based on a specified condition

INCLUDE

Inserts a specified file into the HTML document

LABEL

Assigns a name to a location in the HTML document

Changing the SSI MIME Content Type

By default, Novell Web Server 3.0 does not parse Server Side Include (SSI) commands in HyperText Markup Language (HTML) documents unless you save these documents with the .SSI filename extension. However, you might want to configure Novell Web Server 3.0 so it parses SSI commands in HTML documents that have different extensions. For example, you might want to include a hit counter on each World-Wide Web (WWW) page, and changing all of the .HTM documents to .SSI documents would be tedious. You might also want to use an HTML editing utility that does not recognize .SSI documents as HTML documents.

To configure Novell Web Server 3.0 to parse SSI commands in HTML documents with different extensions, you would complete the following steps:

  1. Use a text editor or word processor to open the MIME.TYP file. By default, this file is located in the SYS:WEB\CONFIG directory.

  2. Locate the following line in the MIME.TYP file:

    text/x-server-parsed-html ssi
    
  3. Change this line to include the appropriate filename extensions. For example, to have Novell Web Server 3.0 parse SSI commands in HTML documents with the .SSI, .HTM, and .HTML extensions, you would change this line as follows:

    text/x-server-parsed-html ssi html htm
    

    You can add as many extensions to this line as you need.

  4. If you added either the .HTM or .HTML extension to the text/x-server-parsed-html line, you must remove this extension from the text/html line. Each extension can be listed for only one MIME content type. If you added both the .HTM and .HTML extensions to the text/x-server-parsed-html line, you should remove the entire text/html line from the MIME.TYP file.

  5. Save your changes to the MIME.TYP file.

  6. Use the Web Manager (WEBMGR) utility to restart Novell Web Server 3.0, or enter the following commands at the IntranetWare server console:

    WEBSTOP
    
     WEBSTART
    

Novell Web Server 3.0 will now parse SSI commands in HTML documents with the extensions you added. Of course, these files must reside in a directory for which you have set the Enable Includes option. (See the "Setting the Enable Includes Option" section.)

Remember that parsing SSI commands requires extra processing. If you configure Novell Web Server 3.0 to parse SSI commands in many HTML documents--such as all of the documents with the .HTML extension--the performance of Novell Web Server 3.0 may be affected.

Field Descriptors for Novell Web Server 3.0

You can use the following field descriptors to determine how to display dates specified in the FLASTMOD command:


%a

Abbreviates the weekday name to three letters

%A

Displays the complete weekday name

%b

Abbreviates the month name

%B

Displays the complete month name

%c

Displays date and time in the following format: Mon Oct 28 14:23:45 1996

%d

Displays the day of the month as a number between 1 and 31

%D

Displays the date in the MM/DD/YY format

%H

Displays the hour as a number between 00 and 23

%I

Displays the hour as a number between 00 and 12

%j

Displays the day of the year as a number between 001 and 366

%m

Displays the month as a number between 01 and 12

%M

Displays the minute as a number between 00 and 59

%p

Displays a.m./p.m. designation for the 12-hour format

%r

Displays the time in a 12-hour format

%S

Displays the second as a number between 00 and 59

%U

Displays the week of the year as a number between 00 and 53, with Sunday being the first day of the first week

%w

Displays the week of the year as a number between 00 and 53, with Monday being the first day of the first week

%W

Displays the week of the year as a number between 00 and 53, with Monday being the first day of the first week

%x

Displays the date in the following format: Oct 28 1996

%X

Displays the time in the following format: 1:45:16

%y

Displays the year without the century (00-99)

%Y

Displays the year with the century (1995, 1996, 1997, and so on)

%Z

Prints the current time zone

%%

Prints the percent sign (%)

A Sample NetBasic Script

The following NetBasic script would generate the dynamic HTML document shown below, which contains hypertext links to two other NetBasic scripts:

NETBASIC SCRIPT
sub main
    DOC:Heading("Links to Scripts")
    DOC:Body
    DOC:Print:H1("Two types of hypertext links.")
    DOC:Link:Text("/netbasic/script1.bas","Launch script1")
    DOC:Link:Button("/netbasic/script2.bas","Launch script2")
 end sub
RESULTING DYNAMIC HTML DOCUMENT
>HTML>
 >HEAD>>TITLE>
 Links to Scripts
 >/TITLE>>/HEAD>
 >BODY>
 >H1>Two types of hypertext links.>/H1>
 >A HREF="/netbasic/script1.bas">Launch script1>/A>
 >FORM METHOD="POST" ACTION="/netbasic/script2.bas">>INPUT TYPE="SUBMIT" VALUE="Launch script2">>/FORM>
 >/BODY>>/HTML>

* Originally published in Novell Connection Magazine


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates