Methods of the CGI Component
[Contents]


The following methods are available. Click a method for its documentaion.

procedure SendHTMLFileVar(FileName: String; Vars: TStringList);
procedure StartSend;
function GetFirstValue(VarName: String): String;
function GetNextValue: String;
procedure SendImage(TheImage: TBitmap);
procedure Send(S: String);

SendHTMLFileVar method

procedure SendHTMLFileVar(FileName: String; Vars: TStringList);

Reads in the HTML file specified in filename and sends it to the web browser. Any occurenced of:

~VARNAME~

in the HTML file is replaced with the corresponding value in the Vars TStringList. The vars TStringList object should contain strings in the following format:

VARNAME=VALUE.

Example

vars:=TStringList.Create;

vars.add('USERNAME=' + GetCurrentUser);
vars.add('LASTLOGIN=' + GetLastLogin);
sendhtnlfilevar('lastlogin.htm', vars);

Notes

The HTML file passed in the filename parameter may not contain a path. The component will expect to find the file in the current directory (the directory where the CGI program is stored) unless you have specified otherwhise, see Creating a CGI System Configuration file.

StartSend method

procedure StartSend;

Call this procedure before sending any output either with Send or SendImage. The ContentType property must be set before calling this method.

GetFirstValue method

function GetFirstValue(VarName: String): String;

Returns the value of the variable specified in varname that was passed to the CGI program from the web browser.

GetNextValue method

function GetNextValue: String;

If a variable has more than one value, as might be the case if you have a HTML form with a multi-select list box on it, then, after calling GetFirstValue to initiate the process, you can call GetNextValue to get the remaining values. If GetNextValue returns an empty string then there are no more values for that variable.

SendImage method

procedure SendImage(TheImage: TBitmap);

Sends the bitmap specified in TheImage to the web browser. You MUST have set the ContentType property to ctGIFImage and called the StartSend method before calling SendImage.

Send method

procedure Send(S: String);

Sends the HTML in s to the web browser. You MUST have set the ContentType property to ctHTMLPage and called the StartSend method before calling Send.