$Web Sub: Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 2: Line 2:
<span class="pageSubtitle"><section begin="desc" />Set delimiter for procedure text substitution<section end="desc" /></span>
<span class="pageSubtitle"><section begin="desc" />Set delimiter for procedure text substitution<section end="desc" /></span>


$Web_Sub sets the delimiter for designating text to be symbolically substituted when text is sent to the client from within ''Model 204'' procedures.
$Web_Sub sets the delimiter for designating text to be symbolically substituted when text is sent to the client from within <var class="product">Model 204</var> procedures.


==Syntax==
==Syntax==
Line 28: Line 28:
<p class="caption">$WEB_SUB return codes</p>
<p class="caption">$WEB_SUB return codes</p>


If not null, this delimiter is then used to identify the text strings in a ''Model 204'' procedure that should be symbolically substituted before presentation to the client. Strings that begin with the given delimiter and end with an exclamation mark ( ! ) will be matched against the Global Variable Table (GTBL), and the value of any such global variables will be substituted for the string.  
If not null, this delimiter is then used to identify the text strings in a <var class="product">Model 204</var> procedure that should be symbolically substituted before presentation to the client. Strings that begin with the given delimiter and end with an exclamation mark ( ! ) will be matched against the Global Variable Table (GTBL), and the value of any such global variables will be substituted for the string.  


Symbolic substitution performed by the $Web_Sub setting only affects lines sent to the client by $Web_ProcSend or by the SEND subcommand in the ON rule chosen for the URL.  
Symbolic substitution performed by the $Web_Sub setting only affects lines sent to the client by $Web_ProcSend or by the SEND subcommand in the ON rule chosen for the URL.  

Revision as of 19:09, 16 June 2012

<section begin="desc" />Set delimiter for procedure text substitution<section end="desc" />

$Web_Sub sets the delimiter for designating text to be symbolically substituted when text is sent to the client from within Model 204 procedures.

Syntax

<section begin="syntax" /> %RC = $Web_Sub( delimiter ) <section end="syntax" />

$Web_Sub is a callable $function (see Calling Sirius Mods $functions), and it takes a single string argument and returns a status code.

delimiter A 1- to 3-character string, or a null string.
Code Meaning
0 Substitution delimiter successfully set.
-1 Invalid call, not a Web thread
-4 Invalid argument (more than 3 characters long)

$WEB_SUB return codes

If not null, this delimiter is then used to identify the text strings in a Model 204 procedure that should be symbolically substituted before presentation to the client. Strings that begin with the given delimiter and end with an exclamation mark ( ! ) will be matched against the Global Variable Table (GTBL), and the value of any such global variables will be substituted for the string.

Symbolic substitution performed by the $Web_Sub setting only affects lines sent to the client by $Web_ProcSend or by the SEND subcommand in the ON rule chosen for the URL.

Until $Web_Sub is called, Janus Web Server does not perform any substitution of strings into procedures sent to the client. Setting $Web_Sub to null also turns off substitution.

Here is a $Web_Sub example:

<HTML>

Greetings from @LOCATION!.

Having a @QUALITY! time.

Wish you were @WISHLOC!. </HTML> . . . %X = $SETG('LOCATION','Springfield') %X = $SETG('QUALITY','nice') %X = $SETG('WISHLOC','rich') %X = $Web_Sub('@') %X = $Web_ProcSend( 'HTMLFILE', 'GREETING' )

In the example above, an at sign (@) is used as the substitution indicator for global names in procedure text. The client would see:

Greetings from Springfield. Having a nice time. Wish you were rich.

As with all $WEB_ functions, $Web_Sub can be invoked by CMD processing, which is specified either in the ON rule for the URL or in the JANUS DEFINE ... WEB command for the port. Note that $Web_Sub can only affect procedures referenced in SEND rules if $Web_Sub is called due to the JANUS DEFINE ... WEB command.