WebHub Commands Quick Reference Guide

Documentation as of 14-July-2014
Expand and Collapse Command Definitions by clicking Group, Category and/or Command Names

Programming Commands

Conditional

ASSIGNED,NOTASSIGNEDConditionally process a phrase based on whether a SessionLiteral or SessionTextArea is not-blank or blank.
 
CMDHASConditionally process a phrase if the whCommandString (in the incoming URL) contains a given text string.
 
IF,IFNOTConditionally process a phrase based on a SessionBoolean setting.
 
IFINDWConditionally process a phrase based on whether content is being requested from inside Dreamweaver MX 2004.
 
IFNOTBLANKSVConditionally process a phrase based on whether a stringvar contains a blank value. No warning when StringVar does not exist.
 
ISWEBROBOTREQUESTConditionally process a phrase based on whether StreamCatcher has detected the current session as coming from a web robot.
 
MATCH,NOMATCHConditionally process a phrase based on the specified comparison of two strings.
 

Control of variables

APPSETTINGSet a custom configuration setting for the application.
 
CHECKSet a single SessionBoolean variable (often a value corresponding to a checkbox) to true.
 
CLEARRemove the named SessionLiterals and/or SessionBooleans from the list kept on TWhSession for the current surfer.
 
CLEARLOCALVARRemove the named LocalSessionVariable from the list kept on TWhSession for the current surfer, for the current droplet.
 
PAGESETTINGSet a variable for the current page.
 
SETSet the value of one or more named SessionLiterals.
 
SETLOCALVARSet the value of one or more named LocalSessionLiterals (automatically cleared when droplet ends).
 
TOGGLEToggle the value of the named SessionBoolean between True and False
 

Export

IFDYNAMICProcess a phrase conditionally based on whether you are making a dynamic HTML page.
 
IFSTATICProcess a phrase conditionally based on whether you are making a static HTML page.
 

External Program Calls

SHELLRun an external program (with optional parameters) and wait for it to finish.
 
STARTStart an external program (with optional parameters) and return immediately.
 

File Processing

INCLUDEInclude the contents of an entire whtml file (here) on the page.
 
SENDFILESend a single file as the response while hiding the file location from the surfer.
 

Flow Control

BOUNCEBounce the user to another resource (with protocol http,https,ftp or mailto) using HTTP redirection. For all except mailto, the URL in the browser address window changes.
 
CLOSEClose the output stream and end the page here.
 
FLUSHClear (reset) the specified output-document buffer.
 
JUMPBACKGenerate a dynamic link to jump back to the prior AppID and PageID as defined onTWhSession.
 
PAGESwitch the surfer to a different page (PageID) within the application. The URL in the browser address window remains unchanged.
 
POPPAGEBounce the surfer to the PageID that was previously stored in a specified SessionLiteral.
 
PUSHPRIORSave prior PageID in a specified SessionLiteral. Use in conjunction with POPPAGE to implement pages or sequences that act as subroutines.
 
PUSHTHISSave current PageID in a specified SessionLiteral. Use in conjunction with POPPAGE to implement pages or sequences that act as subroutines.
 
REQUIRESBounce the surfer to another page if a named SessionLiteral is blank or a named SessionBoolean is false.
 
REQUIRESMATCHBounce the surfer to another page if a specified SessionLiteral does not satisfy the match comparison.
 

HTTP header control

COOKIESend a cookie to the surfer. [Note: use Cookie.key in WHTEKO to view the value] COOKIECLEARSend a cookie expired line in the header.
 
EXPIRESSend an expires header to the web browser. This tells the web browser when to invalidate the cached copy of the web page.
 
HEADERAdd a line to the http header (sent to the browser just before the html page content). SETPROLOGUETYPEReplace the document's prologue with the requested type.
 
SETHTTPSTATUSChange the HTTP status code and description to something other than the default of status 200 OK
 

Optimizing Code Re-Use

CRUNCHKEYSRename literals in a named set so there are no gaps.
 
DECDecrement a literal that contains an integer (subtract 1 from the value).
 
DELKEYSDelete SessionLiterals where their names are based on a specified pattern ending in a number.
 
DYNCHUNKSend a droplet, translation or macro whose name is calculated dynamically.
 
FORProcess a For-loop. For all values between a start integer and end integer, process a specified phrase.
 
INCIncrement a literal that contains an integer (add 1 to the value).
 
LITReturn the value of a numbered StringVar.
 
PARAMSSend a tekero, passing parameters that may be used within the tekero.
 

Security

BOUNCEIFNOTSCHEME Force the use of a certain protocol such as HTTPS.
 
IFINACTIVEFORSECConditionally process a phrase if the session is inactive for a specified number of seconds.
 
SESSIONControl aspects of the the session savestate including the session file's date/time stamp.
 
SESSIONHOUSECLEANCompact the memory used by all sessions and expire old sessions from memory.
 
CODE64STRINGBase64 encode the value.
 

Special

ANCHORRemember a position within the output document by name (and any optional required Anchors before sending contents).
 
ANCHORMODIFYSubstitute content into a remembered ANCHOR position.
 

Output Commands

Database

FIELDDisplay the contents of a named field for the current database record in a specified datasource.
 

Documentation

CMDDisplay dynamic content (as source or expanded content) based on the whCommandString from the incoming URL.
 
SOURCEDisplay the WebHub HTML source behind a tekero, for training purposes.
 
SUMMARYAdd text to the WebHub page-footer (after all sections are sent).
 

Export

DYNACTIONForce a dynamic action attribute in a <form action="~~~"...> opening tag heading to a WebHub PageID.
 
DYNJUMPUse this to link to the dynamic version of a PageID, from an exported static page.
 
STATICJUMPGenerate a link <a href...>~~~</a> to the static version of a page (ExportURL + ExportFileName)
 

Forms

ACTION,ACTIONRGenerate a dynamic URL commonly used for the action attribute of a <form action="~~~"...> opening tag. Use ACTIONR for a random session suffix.
 
INPUTCHECKBOXGenerate an <input type="checkbox" name="x" value="yes" {checked="checked" depending on (~x~)}... /> tag.
 
INPUTDEFAULTGenerate the default value for any input tag
 
INPUTFILEGenerate an <input type="file" name="x"... /> tag for uploading files to a server.
 
INPUTHIDDENGenerate an <input type="hidden" name="x" value="(~x~)"... /> tag.
 
INPUTIMAGEGenerate an <input type="image" name="x" value="(~x~)"... /> tag.
 
INPUTPASSWORDGenerate an <input type="password" name="x" value="(~x~)"... /> tag.
 
INPUTRADIOGenerate an <input type="radio" name="x" value="yes" {checked="checked" depending on (~x~)}... /> tag.
 
INPUTRESETGenerate an <input type="reset" name="x" value="(~x~)"... /> button tag.
 
INPUTSELECTGenerate a <select...> tag based on a list. Multiple selection can be specified.
 
INPUTSELECTRADIOGenerate a series of radio buttons <input type="radio" name="x" value="yes" {checked="checked" depending on (~x~)}... /> based on a list.
 
INPUTSELECTCHECKBOXGenerate a series of checkboxes <input type="checkbox" name="stem_X" value="yes" {checked="checked" depending on (~stem_X~)}... /> based on a list.
 
INPUTSUBMITGenerate an <input type="submit"... /> button tag.
 
INPUTTEXTCreate an <input type="text" name="x" value="(~x~).. /.> tag.
 
INPUTTEXTAREAGenerate a <textarea name="x"...>{~x~)</textarea> tag.
 

Navigation

GO,GORGenerate a dynamic link which will be inactive if pointing at the current page. Use GOR for a random session suffix.
 
HIDE,HIDERGenerate a link which will be hidden if pointing at the current page. Use HIDER for a random session suffix.
 
JUMP,JUMPRGenerate a dynamic link to a page within a WebHub application. Use JUMPR for a random session suffix.
 
MAILTOCreate a mailto link.
 

WebHub Command Syntax Definition - Legend

All WebHub Commands syntax definitions have the format

(~RESERVEDCOMMANDNAME|parameters~)

The surrounding (~ ~) characters are called parentils, and these delimiters are used for all WebHub Expressions (see below).

For built-in WebHub Commands, the RESERVEDCOMMANDNAME is a reserved word that WebHub uses to activate a specific feature.

The RESERVEDCOMMANDNAME is followed by a vertical bar |which is followed by none, one or more than one parameters.

For syntax definition purposes, all parameters are given names (eg. phraseWhenTrue) using alpha-numeric characters without any spaces.

A parameter name surrounded by < > characters (eg. <operator> means that it is an enumerated type, and the possible values are shown in the syntax parameter definition. The < > characters are only included to identify the parameter as an enumerated type and do not form part of the command syntax.

Some parameters are optional, and this is indicated by the surrounding [ ] characters and a highlighting background color (eg. [||phraseWhenFalse]).

All non-alpha-numeric characters (except [ ] and <>) such as | , # ; ! $ ~ (when shown) are a required part of the command syntax.

When the word Phrase is used in a command parameter name or parameter definition, this means a mixture of html, text and/or WebHub Expressions.

When a parameter can itself be a WebHub Expression, nesting of expressions is allowed to a depth of 40.

WebHub Command Parameter Expansion - Legend

At the end of each parameter description for all WebHub Commands is a single character enclosed in parenthesis. This is an abbreviation for the type of expansion performed on that parameter as the command is processed.

(a)AlwaysAlways expand the phrase, even if not surrounded by parentils. (c)ConditionalExpansion is conditional and depends on the specific command and parameter. (e)ExplicitSurrounding parentils are REQUIRED for expansion. (i) Implicit Contents are assumed to be a single identifier and expansion is automatic if the identifier is found. Text that does not represent an identifier will be used as is. Surrounding parentils are NOT required.(n)Never The parameter is used exactly as given and never expanded. Do not use parentils.

WebHub Application Server System - A brief overview

A WebHub Application Server System provides dynamic content for web pages using a collection of interactive software components. These components are:

Operating System eg. Windows Server 2003 http Server Software eg. IIS 6 WebHub WebServer Module eg. runisa.dll for IIS (from HREF Tools Corp). WebHub Service hub.exe (from HREF Tools Corp). WebHub Application(s) compiled Object Pascal program. This is an EXE file WebHub whteko filesFiles containing a mixture of WebHub xml tags, html content and WebHub Expressions. Optional database(s) / service(s)Optional database, COM, services and other applications.

WebHub Applications and whteko files can be completely tailored by a developer or development team. WebHub's architecture lends itself to an easy separation of database connectivity, programming logic and business rules managed by the "programmer" skill-set of a team (or individual), and the visual presentation, navigation, and site layout managed by the "webmaster or graphic designer" skill-set.

The following information is focused on WebHub Expressions as used within the WebHub whteko files.

WebHub Expressions

WebHub Expressions are used within HTML markup to:

1. dynamically insert content into a web page while it is being generated by a WebHub Application (WebHubApp), and 2. interact directly with a WebHubApp's logic and data.

The server-side source is called W-HTML and is generally stored in *.whteko files which can contain a collection of WebHub tekeros (pronounced tek-air-oze). The tekeros are pages, droplets, translations and macros that are defined using special syntax xml tags (called teko tags) within whteko files. All of these tekeros can use WebHub Expressions mixed with HTML. For information on the teko syntax, see webhubsyntaxstage0214.pdf

A WebHub Expression is any sequence of commands and nested expressions surrounded by parentils.

Parentils are the delimiters (~ and ~). These are used to distinguish a dynamic WebHub expression from the surrounding html and are used for nesting expressions within expressions.

There are 5 basic types of atomic (non-nested) WebHub Expressions.

Command a built-in or a custom commandeg. (~CLEAR|~) Tekero a page, droplet, translation or macroeg. (~drPageHeader~) Session variable a SessionLiteral or SessionBooleaneg. (~slUserName~) WebAction Methoda method of a WebAction componenteg. (~waWebAction.Execute|~) Component Propertya property of a Delphi componenteg. (~WebServer.WebTime~)

Expressions can be nested to a depth of 40.

Naming Conventions in WebHub Expressions - Best Practices

WebHub expression types look very similar at first glance.

For example:

1. a Command (~Text|moreText~) 2. a Tekero (~Text~) 3. a Session variable (~Text~) 4. a WebAction Method (~Text|moreText~) 5. a Component Property (~Text~)

Because of this similarity, developers are encouraged to use best practices naming conventions as follows:

1. naming Commands

For Custom Commands that you implement in Object Pascal, choose a prefix (perhaps your product's initials)

eg. tp prefix for a product called TurboPress (~tpHEADLINE|moreText~)
2. naming Tekeros

Distinguish between tekero types by using the following prefixes:

dr for droplets eg. (~drPageHeader~) mc for macros eg. (~mcSiteRoot~) pg (or blank) for pages eg. (~pgAdminMenu~) or (~AdminMenu~) for translations (this is a required prefix) eg. (~~city~)

Because the pg will be included as part of the page name in the URL, the pg prefix is usually only used for training demos or on in-house non-public pages. If no page prefix is used, then page expressions are only identifiable as pages if all other WebHub Expression types use the best-practices prefix approach.

3. naming Session Variables

Session variables require a carefully thought out strategy for prefixing.

The simplest form might be:

svVarNamewhere sv is a prefix that stands for session variable

Session variables can be SessionLiterals or SessionBooleans, so a more useful approach might be:

slVarNamewhere sl stands for SessionLiteral (a string variable) sbVarNamewhere sb stands for SessionBoolean (true / false variable)

Furthermore, SessionLiterals can be set (or cleared) within WHTML, or set after a form has been posted by a site visitor. In the latter case, these incoming variables could be efficiently cleared using a wildcard approach, so one possible idea is to use:

inFormNameVarNamewhere in means input data and FormName is the name of the form containing the input field named inFormVarName. A group of session variables, so named on the form FormName, could all be cleared using (~CLEAR|inFormName*~)

For dynamic database driven applications, another approach is as follows:

inDataSetNameTextwhere "in" means input data and DataSetName is the name of the DataSet for which the contents of the input field named inTableNameText is to be used for querying or updating or inserting.

Lastly, but most importantly, a "_" prefix for any session variable name means that the site visitor is unable to change the session variable's contents i.e. only server side modifications are possible using either Delphi code or WEbHub commands such as (but not limited to) SET,CLEAR,CHECK and TOGGLE.

eg. _sbLoggedIn as a protected SessionBoolean that indicates the logged in status of a site visitor.

If in doubt, start with a prefix of sv, and refine your approach over time as your application evolves. A mixture of techniques is often beneficial in terms of readability and convenience.

4. naming WebAction Methods

For a WebAction Method

(i) within Object Pascal, prefix the WebAction component name with "wa" (ii) specify the "method" name even if it is "Execute". (Execute is the default method and is implied but should be specified) (iii) use the vertical bar after the method name even if no parameters are being passed to the webaction eg. (~waWebActionName.Execute|moreText~) or (~waWebActionName.Execute|~)
5. naming Component Properties

For Component Properties, include the component name and a "." as a prefix, even though this is not required.

eg. instead of (~WebTime~) use (~WebServer.WebTime~)

WebHub Command Syntax

All WebHub Commands have the syntax (~command|parameters~) where

command is a reserved word representing either a built-in WebHub feature or a custom feature (defined by a developer), in both cases serviced by the WebHubApp parametersis a predefined sequence of required and optional Phrases that vary according to the command used. A Phrase is a mixture of html, text and/or WebHub expressions.

Consider the WebHub Command IF

Syntax

(~IF|sessionBooleanName|phraseWhenTrue[||phraseWhenFalse]~) sessionBooleanNameName of a SessionBoolean (an entry in the TWebSession.Checked array) to test. phraseWhenTruePhrase to process when IF condition is true. phraseWhenFalsePhrase to process when IF condition is false.

An example of using the IF command in a WebHub Expression within a whteko file might be:

(~IF|_sbLoggedIn|(~JUMP|UserDetails|My Details~)||&nbsp;~)~)

A full analysis of this expression is as follows:

From the range of WebHub Expression types (Command, Tekero, Session Variable, WebAction Method, Component Property), this expression can be identified as either a Command or WebAction Method because it has the format of (~Text|moreText~). More specifically the format is (~IF|moreText~) where IF is a reserved word and is a WebHub Built-In Command, so this expression is a Command.

Analysis as syntax:

Referring to the above syntax specification for the IF command, the command's parameters are:

sessionBooleanName_sbLoggedIn phraseWhenTrue(~JUMP|UserDetails|My Details~). phraseWhenFalse&nbsp;

The phrase to process when true is a nested WebHub Expression and is in fact a JUMP command.

The phrase to process when false is standard html in this case.

Analysis in words:

If the protected SessionBoolean named _sbLoggedIn is true then generate an <a href...>~~~</a> tag where the href attribute equals the dynamic url required to navigate the site visitor to the UserDetails page within the current application, and where the visible text of the link will say "MyDetails", else, generate a non-breaking space.

The generated tag would look something like:

<a href="/scripts/runisa.dll?AppID:UserDetails:12345">My Details</a>

Analysis in over-simplified pseudo code:

if (_sbLoggedIn == true)
	write('<a href="/scripts/runisa.dll?AppID:UserDetails:12345">My Details</a>')
else
	write('&nbsp;');	

Analysis in illustrative but not recommended Object Pascal:

if pWebApp.Checked['_sbLoggedIn'] then
  WebOutput.Send(
    '<a href="'
    + pWebApp.cgiApp + ':'       {this generates /scripts/runisa.dll?AppID}
    + 'UserDetails:' 
	   + IntToStr(pWebApp.Session)  {this generates 12345}
	   + '">My Details</a>')
else
  WebOutput.Send('&nbsp;');	

Analysis in best practices Object Pascal

if pWebApp.Checked['_sbLoggedIn'] then
  WebOutput.SendJump('UserDetails','My Details');
else
  WebOutput.Send('&nbsp;');