Web-Box HTML Client Documentation
 
Web-Box
Introduction
Benefits
Documentation

 
Quickfinder
Home
Products
Consulting
Company


 
Web-Box HTML Client Documentation
 
 
Table of Contents
 
Basic Functionality
How to engage Web-Box? (Installation)
Data Types
Basic Operations
Multi Language Support
3-Tier Functionality
Function Index
Design specific Limitations
Order Information
Copyright Information
Legal Disclaimer

Back to Table of Contents


 
 
Basic Functionality

Web-Box code is embedded in the HTML page, and processed on the server. There is no code on the client computer.

Sample of a Web-Box enabled HTML page:


<HTML>
<HEAD>
<TITLE>Simple HTML Document</TITLE>
</HEAD>
<BODY>
<H1>Today is <!--#print(time("%A")); -->
<P>The Web-Box block can be even larger:
<P>
<!--#
if (StringSearch(getenv("HTTP_USER_AGENT"), "MSIE") >= 0 {
  print("It appears you use Microsoft Internet Explorer\n");
  } else {
  print("It appears you don't use Internet Explorer\n");
  }
-->
<P>You can also include files:
<!--#include("footer.html"); -->
</BODY>
</HTML>

Back to Table of Contents


 
 
How to engage Web-Box?
 
 
Installation

The standalone system has only one CGI-script or program. The filename is "wb.exe" for Windows and "wb" for Unix.

There are different versions for Unix available. If you have a different Unix or need other libraries, talk to us and we can compile the system for the requested platform.

This script has to be installed on the server in the script directory.  
 
Configuration

For security reasons, Web-Box uses a directory of Web-Box enabled web pages. This directory is part of the configuration file and lists all filenames and their shortcuts. For the fully featured version of Web-Box, there is a security level parameter attached in this directory.

Sample of the file "wbcfg":


\IncludeFiles {
  \FirstScreen {fs.html}
  \SecondScreen{main.html}
  }

You can now access the files with your browser, by pointing it to

"http://127.0.0.1/scripts/wb.exe?BuildScreen=FirstScreen" for Windows or

"http://127.0.0.1/cgi-bin/wb?BuildScreen=FirstScreen" for Unix

You can also omit the "BuildScreen=" parameter and use

"http://127.0.0.1/scripts/wb.exe?FirstScreen" for Windows or

"http://127.0.0.1/cgi-bin/wb?FirstScreen" for Unix

NOTE: Under the Apache web server, it is very easy to hide the script call with the use of the mod_rewrite engine, so your dynamic pages will look static.

Back to Table of Contents


 
 
Data Types

The system supports 4 different types of variables:

  • string, which consists of 0 to 1500 chars
  • int - 32 bit integer
  • fint - 32 bit integer followed by the number of decimals
  • date - calendar date

Unlike C, the system automatically converts data-types.

Note: A boolean variable is an integer with the value of "1" representing TRUE and "0" FALSE.

Samples:


string greeting = "Good morning";
int number_of_retries = 12;
fint account_balance = 123.32;
date today = 20001124;

Back to Table of Contents


 
 
Basic Operations

The system supports the following mathematical functions:
 
Function Operator int fint string date
Add + yes yes yes no
Minus - yes yes no no
Multiply * yes yes no no
Divide / yes yes no no
And bitwise & yes no no no
Or bitwise | yes no no no
And logical && yes no no no
Or logical || yes no no no
Modulo % yes no no no
Assign = yes yes yes yes
Compare if equal == yes yes yes yes
Compare if not equal != yes yes yes yes
Compare if greater > yes yes yes yes
Compare if greater or equal >= yes yes yes yes
Compare if less < yes yes yes yes
Compare if less or equal <= yes yes yes yes

The system supports braces and normal priority.

Sample:


int result;
fint resultf;
string results;

result = ((2 * 3) / 2) + 1;
resultf = 2.00 / 4;
results = "Today is " + time("%A");

Back to Table of Contents


 
 
Multi Language Support

If you define the variable LANGUAGE, you enable this feature. For each possible language, 2 chars are used. The currently active language is defined in the first 2 chars.

To define English, Spanish and German as possible languages, you write:


<!--#string LANGUAGE = "enesde"; --> 

This statement selects "en" as language. It also defines, that <es> and <de> are interpreted as starts of not selected language blocks. These blocks will be ignored, including all eventual command blocks.

Sample:


<!--#
string LANGUAGE = "ende"; 
if ((StringSearch(getenv("HTTP_ACCEPT_LANGUAGE"), "en") < 0) &&
    (StringSearch(getenv("HTTP_ACCEPT_LANGUAGE"), "de") > 0)) {
  LANGUAGE = "deen";
  }
-->

<en>
Welcome to our web site
</en>
<de>
Willkommen auf unserer Web-Site
</de>

Note: This function can also be used for other optional content, such as to print some paragraphs under certain conditions.

Back to Table of Contents


 
 
3-Tier Functionality

Note: In order to have 3-tier functions, you must have an installed Web-Box server. This server is a normal process, a demon or a system service, depending on the platform you use.

How does it work?

To call a server functions, you fill out one communication buffer, called "request", with the desired parameters. You then call SendRequest() to engage the server. The server will return the result of your request in the communication buffer "answer".

Communication buffers are 63 KB in size, and can include many different variables, fields and arrays. The normal processing speed of an easy function call can be as small as 2 ms, and can be as large as 1000 ms and more.

Sample:


<H1>Welcome</H1>
<!--#
InitRequestBuffer();
request.s.FILE_NAME = "visitors";
request.s.MESSAGE = getenv("REMOTE_ADDR")+"\r\n"+
                    getenv("HTTP_COOKIE")+"\r\n";
request.ctrl.function = WRITE_LOG;
SendRequest();
-->

Back to Table of Contents


 
 
Function Index
 
print
time
milliseconds
ReadSystemDate
mid$
strlen
asc
chr$
trim
StringSearch
StringSearchI
StrWildCmp
include
if
switch
while
break
stop
rand
getenv
ReadGetPostData
GpReset
GpVname
GpVvalue
GpSkip
FormatTextField
ConvertCRLF
UniqueCookie
SetCookie
round
FormatNumber
ifdef
undef
AccessVar
InitRequestBuffer
PushCommBuffers
PopCommBuffers
SendRequest
SendRequestExt

Back to Table of Contents


 
 
print (string what_to_print)

This function prints the content of what_to_print. It does not append anything to the string. If you like to add a LF, you must do so with "\n".

In case the function is called with an int, fint or date parameter, this parameter is converted to a string.

Sample:

print("Today is " + time("%A") + "\n");

Back to Function Index

 
 
string time (string format_string)

This function returns the current time, according to the format_string. The format_string has the same format than the C-function strftime.

Sample:

print(time("%I:%M%p %Z on %A"));

Back to Function Index

 
 
int milliseconds()

Return the system time in milliseconds.

Note: Not all operating systems supply this number. On non-supported platforms, this function returns a number of seconds times 1000. (All newer Linux and Windows NT systems support this feature).

Back to Function Index

 
 
date ReadSystemDate()

Read the current system date.

Back to Function Index

 
 
string mid$ (string source, int position, int len)

Mid$ isolates one part of source. It starts at position (1-based, first char is at position 1) and takes len chars. If source is shorter, it returns all available chars.

Sample:

print(mid$("Hello World", 1, 5));

Back to Function Index

 
 
int strlen(string source)

Get the length of source.

Back to Function Index

 
 
int asc(string source)

Return the ASCII-code of the first character of source.

Back to Function Index

 
 
string chr$(int value)

Generate a string with one character with the ASCII value of value.

Back to Function Index

 
 
string trim(string source)

Trim all trailing blanks of source.

Back to Function Index

 
 
int StringSearch(string source, string search_string)

Search the string search_string in source. In case search_string is included in source, the offset of the first match is returned (1-based). In case the string could not be found, -1 is returned.

Sample:

if (StringSearch(getenv("HTTP_USER_AGENT"), "MSIE") >= 0) {
ie = 1;
} else {
ie = 0;
}

Back to Function Index

 
 
int StringSearchI(string source, string search_string)

Like StringSearch, only case insensitive.

Back to Function Index

 
 
int StrWildCmd(string source, string cmp_value)

Compare string source with cmp_value. cmp_value can include the wildcard character "@" for any number. The function returns 1 in case there is a match, not 1 otherwise.

Sample:

if (StrWildCmp(getenv("HTTP_USER_AGENT"), "MSIE @.@")) {
ie = 1;
} else {
ie = 0;
}

Back to Function Index

 
 
include (string file)

This function includes the file named file. If you have functions defined in file, you must start a new command block in order to access them. This is caused by the fact that command blocks are compiled before they are executed. Include is part of a command block, and not handled with a preprocessor.

This way of processing makes it possible to have other command blocks in the include file, and you do not have to take too much care about the status. All variables defined in the included file are accessible on the upper level as well.

If you wish not to use variables, remove them with "undef".

Note: You can also define functions on the lower level.

Sample:

include("webbox_header.html");

Back to Function Index

 
 
if (int condition)

If controls the conditional execution of code. The parameter condition if checked if it is "1". In this case the if-clause is executed, otherwise the "else" clause is executed.

Sample:

if (a == 5) {
print("a is 5");
} else {
print("a is not 5");
}

Back to Function Index

 
 
switch (value)

The Web-Box switch statement works different than the C-language switch, because this switch also works with different variable types. The system decides which mode to use from the variable type of value. The rest of the functionality is similar to the C-function, including "break" and "default".

Sample:


int a = 5;

switch(a) {
  case 1:
    print("a is 1");
    break;
  case 2:
  case 5:
    print("a is 2 or 5");
    break;
  default:
    print("a is not 1, 2, or 5");
    break;
  }

string received_greeting = "Hello";

switch(received_greeting) {
  case "Hello":
    print("Hello - How are you?");
    break;
  case "Good evening":
  case "Good morning":
    print(received_greeting);
    break;
  default:
    print("You are unfriendly!");
    break;
  }

Back to Function Index

 
 
while (int condition)

With while, you build a loop in your code. You can stop the execution at any time with a "break" statement.

Sample:

a = 0;
while (a < 5) {
print("Bla");
a++;
}

Back to Function Index

 
 
break

"break", used with the "while" or "switch" statement.

Sample:

break;

Back to Function Index

 
 
stop()

"stop", stops the parsing of the current source file.

Sample:

stop();

Back to Function Index

 
 
int rand()

Return a random number. The random generator (=seed) is initialized with the current system time.

Sample:

print((rand() % 6) + 1);

Back to Function Index

 
 
string getenv(string variable_name)

Getenv enables you to read CGI variables from the web server. The following variables are supported:

  • HTTP_USER_AGENT
  • HTTP_UA_PIXELS
  • HTTP_UA_COLOR
  • HTTP_UA_OS
  • HTTP_UA_CPU
  • HTTP_REFERER
  • HTTP_COOKIE
  • HTTP_ACCEPT_LANGUAGE
  • REMOTE_HOST
  • REMOTE_ADDR
  • SERVER_NAME
  • SERVER_PORT_SECURE
  • SCRIPT_NAME
  • CONTENT_TYPE

Sample:

print("You are using " + getenv("HTTP_USER_AGENT"));

Back to Function Index

 
 
string ReadGetPostData(string variable_name)

ReadGetPostData enables you to read GET/POST variables from the web server. Special chars, such as blanks and other reserved characters will be translated into their normal form.

Note: The function FormatTextField can be used to translate a normal string to these special chars.

Sample:

print("You selected " + ReadGetPostData("CChoice"));

Back to Function Index

 
 
int GpReset()

The Gp-function complex is used to read the GET or POST data sequentially. This will save the computer substantial processing time when processing data from a client.

These functions are available:

  • GpReset - Set read pointer to first GET / POST field. Return not 1 if no first element is available.
  • GpVname - Get variable name at the current pointer location
  • GetVvalue - Get variable content at the current pointer location
  • GpSkip - Advance read pointer one field. Return not 1 if no other element is available.

Back to Function Index

 
 
string GpVname()

Check GpReset for an explaination of this function.

Back to Function Index

 
 
string GpVvalue()

Check GpReset for an explaination of this function.

Back to Function Index

 
 
string GpSkip()

Check GpReset for an explaination of this function.

Back to Function Index

 
 
string FormatTextField(string text)

FormatTextField replaces all special characters from the variable text, so that an entry field can be set accordingly. Chars include "<>" and so on.

Sample:

CChoice = FormatTextField(CChoice);

Back to Function Index

 
 
string ConvertCRLF(string text)

ConvertCRLF replaces all CRLF or LFCR sequences by a LF only. This function is useful to parse multiline input fields from Windows clients.

Sample:

LongText = ConvertCRLF(LongText);

Back to Function Index

 
 
string UniqueCookie()

This function returns a unique cookie for the current session. The system automatically sets this cookie in case it is not set. This cookie expires after 36 hours or when the customer restarts his browser.

There is no explicit use of this cookie for the standalone system. It is very useful if you use 3-tier functions. It can be used to find the session_id or other temporary data for the current session.

Sample:

print(UniqueCookie());

Back to Function Index

 
 
SetCookie(string cookie)

This function sets a custom cookie. It has to be called before any text is written to the HTML document. The syntax is the "Set-Cookie" syntax from the HTML response header.

Sample:

SetCookie("MyName=Alpha");

Back to Function Index

 
 
fint round(fint number, int number_decimals)

Round number to number_decimals.

Back to Function Index

 
 
string FormatNumber(fint number, int number_decimals, int nice_looking)

Format number to a string with number_decimals decimals. If nice_looking is "1", thousands separators are inserted.

Back to Function Index

 
 
int ifdef(string variable_name)

Check if the variable variable_name is defined and return "1" if it is the case.

Back to Function Index

 
 
undef variable_name

Undefine the variable variable_name.

Sample:

undef i;

Back to Function Index

 
 
AccessVar(string variable_name)

With the use of this function, it is possible to access variables with the help of a name stored in variable_name. It is very useful when used in functions.

Sample:

int i = 12;
string vname = "i";

print(AccessVar(vname));

Back to Function Index

 
 
InitRequestBuffer()

This 3-tier function is used to initialize the request buffer for calling a server based function.

Back to Function Index

 
 
PushCommBuffers()

This 3-tier function is used to temporarily save the content of the request and answer buffers. This is useful if you have data in more than one level.

Back to Function Index

 
 
PopCommBuffers()

This 3-tier function is used to restore the content of the request and answer buffers that have been saved with PushCommBuffers.

Back to Function Index

 
 
SendRequest()

This 3-tier function is used to call one function on the server.

The function's input parameters are stored in the request buffer, the server's answer is stored in the answer buffer.

This function includes an internal error handler. This error handler interrupts the current HTML page in case of a critical error, and displays the error instead. Samples of such errors are "Connection expired" or "Login not successful".

Soft errors, such as "Record no longer available", are indicated by a non-zero value of "answer.ctrl.ret_val.code". The error message is returned in "answer.ctrl.ret_val.text".

Back to Function Index

 
 
SendRequestExt()

This function is identical to SendRequest, with the exception that most errors are returned as errors.

The error text is available at "answer.ctrl.ret_val.text" in text form. It is set if "answer.ctrl.ret_val.code" is not zero. A value of 1 is a non critical error, a value of 2 is critical.

Back to Function Index


 
 
Design specific Limitations

The following limitations apply:

  • The max. compiled size of one command block is 64 kB.
  • The max. size of all active local variables is 64 kB.
  • The max. compiled size of all functions is 64 kB.
  • The max. length of a string is 1500 characters.
  • Web-Box is a single parse compiler, which means it can not reference forward.

Note: These limitations allow the system to employ very efficient and fast memory handling.

Back to Table of Contents


 
 
Order Information

Please send your orders/inquiries to:

Email: sales@parabase.com

Web English: http://www.parabase.com
Web German: http://www.parabase.de

Back to Table of Contents


 
 
Copyright Information

This system is copyrighted material, not shareware and not public domain.

If you use this program on your web site, you have to buy it.

Back to Table of Contents


 
 
Legal Disclaimer

THIS PROGRAM AND DOCUMENTATION IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY KIND. PARABASE AND ITS PARTNERS, DISCLAIM ALL EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICUALAR PURPOSE, AND ANY WARRANTY AGAINST INFRINGEMENT TO THE MAXIMUM EXTENT POSSIBLE BY LAW.

LIMITATION OF LIABILITY: TO THE MAXIMUM EXTENT POSSIBLE BY LAW, IN NO EVENT SHALL PARABASE, OR ITS PARTNERS BE RESPONSIBLE FOR ANY DAMAGE OF ANY KIND (INCLUDING, WITHOUT LIMITATION, LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTIONS, LOSS OF CLIENTS, LOSS OF DATA, DATA CORRUPTION) THAT IS INCURED DURING THE USE OF PARABASE SOFTWARE DUE TO FAILURE, OR WHATEVER REASONS, EVEN IF PARABASE, OR ITS PARTNERS HAVE KNOWLEDGE ABOUT THE POSSIBILITY OF SUCH A PROBLEM. IN NO CASE, OTHER THAN DISALLOWED BY LAW, SHALL PARABASE, OR ITS PARTNERS, BE LIABLE FOR MORE THAN THE AMOUNT PAID FOR THE SOFTWARE IF THIS AMOUNT IS GREATER THAN US $100, US$100 IN ALL OTHER INSTANCES.

(c) 1998-2002 Copyright by Parabase Consulting GmbH, Germering
All Rights Reserved.

Back to Table of Contents


 
 
Home
 
Please tell us what you think about this site. E-mail comments@parabase.com
(c) 1998-2003 Copyright by Parabase Consulting GmbH, All Rights Reserved.
Powered by Parabase Web-Box