Back Up Next

Step 2: Editing the Server Configuration File

The phonebook.conf file for UNIX contains the following entries specific to this sample application:

appName="phonebook"
client="fglcl.exe"
defaultProgram="./start"
service="6500"
serverNumber=96
emulateHTML=1                             

appName
Creates the link between each page.
client
The name of the client that you are using. In this case, combining appName with client will give you this call: fglcl.exe?phonebook.
defaultProgram
The script used to initialize the program. This is the start script described in step 3.
service
The base port number.
serverNumber
The offset from the base port (6500) used to create the final port number. For example, this file specifies port 6596.
emulateHTML
Instructs the server to emulate HTML automatically.

Examples of Configuration Settings

This section describes updates that you can make to the appname.conf file.

The following is an example of the "General Features" section of the configuration file for the phonebook example. The file is named phonebook.conf:

# General features
#####################################

# Version of the configuration script
version="0.94.2a"

# Application Name
appName="phonebook"

# Script name in the /cgi-bin/ directory
# fglcl for Unix
# fglcl.exe for Unix / Windows NT
client="fglcl.exe"

# Service-name to register the daemon
service="6500"

# The offset from server-name-port
serverNumber=96

# Security Level
securityLevel=1

# Expirations-Time for Application in seconds
timeOut=1200

# Maximum tasks (default : -1)
maxTasks=10

# Debug level 0-none 1-verbose 2-no demonize (foreground)
debug=0                                   

Styles Configuration

To change the appearance of the application in the browser, you can edit the "Configuration of Styles" section in the appname.conf file. For example, the phonebook.conf file has these values:

# Configuration of Styles
#########################

# Buttons below form
buttonDown=0

# Errors below form
errorDown=0

# Answer as Multipart/Mime (Use this when uploading of files needed!)
multipart=0

# Show menu entries as links (not Buttons)
menuAsLink=0

# Width of form's buttons (0 means minimum)
buttonWidth=10

# Width of menu fields (0 means minimum)
menuWidth=0

# HTML Emulation (default : 0)
emulateHTML=0

# Images path (default : "/images")
imagePath="/Cli-HTML/clipart"

# Show alternate text for images (default : 0)
showImageAlternate=1

# Border width of an image when image is a link (default : 2)
imageBorder=2

The emulateHTML variable must be set to 0 if you want to include HTML tags in your .per screen files.

Spawning Method

The spawning method determines how the application is started. The different methods do not interfere with the look and feel of the interface.

# Spawning methods
##################

# Spawn method
# 0 : spawned by shell
# 1 : spawned by runner and environment variables
spawnMethod=0

# Script to start the application 
defaultProgram="start"

# Runner name
fglrunName=""

# Start module
fglrunTarget=""

# Environment
# Note : do not use environment variables within definition of environment
fglrunEnv0=""                                         

Arrays

You can specify using custom arrays to improve the look and feel of your application in the "Arrays" section:

# Arrays
########

# Array is seen as a button (default : 0)
arrayAsButton=1

# Image array (default : "/images/bullet.gif")
arrayImage="/Cli-HTML/clipart/phonebook-bullet.gif"     

Pre- and Post-Page Macros

The "Pre- and post-page macros" section specifies pre-defined macros to set:

A sample section for phonebook.conf is:

Note:
Indicates that the line would normally continue on the same line.

# Pre and post page macros 
##########################
$NEEDED1="Pragma: no-cache
Content-type: text/html
"
$NEEDED2="
<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">
<META HTTP-EQUIV=\"Cache-Control\" CONTENT=\"no-cache\">
"
$BACKCOLOR="BGCOLOR=\"#6F6FFF\""
$TITLE="<TITLE>The Phonebook - Demonstration</TITLE>"
$TRYAGAIN="<A HREF=\"/cgi-bin/fglcl?phonebook\">Try again</A>"
$REFRESH=
"<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"10; URL=/cgi-bin/fglcl?phonebook\">"
$HEAD="<IMG SRC=\"/Cli-HTML/clipart/phonebook-large.gif\" ALIGN=LEFT>
<H3>The Phonebook</H3>"
$TAIL="<HR>
<CENTER>Welcome to <B>The Phonebook</B> Demo program!</CENTER>
</BODY>
</HTML>"

# Header
headRecord="$NEEDED1
<HTML>
<HEAD>
$NEEDED2
$TITLE
</HEAD>
<BODY $BACKCOLOR>
$HEAD
"
# Tail
tailRecord=
"$TAIL"
# Error
errorRecord=
"Pragma: no-cache
Content-type: text/html
<HTML>
<HEAD>
$NEEDED2
$REFRESH
$TITLE
</HEAD>
<BODY $BACKCOLOR>
$HEAD
<BR>
An error has occured...<BR>
Error %s<BR>
<BR>
$TRYAGAIN
$TAIL
"
# Time Out
timeOutRecord=
"Pragma: no-cache
Content-type: text/html
<HTML>
<HEAD>
$NEEDED2
$REFRESH
$TITLE
</HEAD>
<BODY $BACKCOLOR>
$HEAD
<BR>
This application has been terminated on timeout ...<BR>
$TRYAGAIN
$TAIL
"
# Normal end
endRecord=
"$NEEDED1
<HTML>
<HEAD>
$NEEDED2
$TITLE
</HEAD>
<BODY $BACKCOLOR>
$HEAD
<BR>
Thanks for trying The Phonebook <BR>
$TRYAGAIN
$TAIL
"                            

Results of Updating the Application Configuration File

The modifications shown in the sample configuration file change the sample application display from this:

Before

To this:

After

 

The changes shown in this example are as follows:

  1. A small animated gif.
  2. A header designed in the appname.conf file.
  3. A small modification in the forms.
  4. An array header.
  5. A background color.

Step 3: Creating a Script to Initialize the Application

The shell launched to initialize the program on UNIX is named start and contains the following code:

#!/bin/sh

FGLGUI=2
export FGLGUI

FGLPROFILE=$FGLDIR/etc/fglprofile.web
export FGLPROFILE

exec fglrun main                         

This script sets FGLGUI to 2, which is the mode used for HTML applications. It also specifies an FGLPROFILE file that is used for HTML applications.

Step 4: Editing Your Client Configuration File

The fglcl.conf file is located in the web server's cgi-bin directory. For more information on the client configuration file, see fglcl.conf.

Modify the following parameters in the fglcl.conf file:

phonebook.fglserver=app_server_ip_address:96
phonebook.debug=0
phonebook.HTMLdebug=0

Replace app_server_ip_address with your application server's IP address. You can use the application server's name or fully qualified hostname and domain name; however, this can require a DNS lookup or a search in /etc/hosts (%WINDIR%\system32\drivers\etc\hosts on Windows NT), which can slow performance.