SBM AppScript Reference → Introduction to SBM AppScript → SBM AppScript Contexts → Direct Access Contexts → HTML Template Direct Access Context
Every SBM browser page is generated from an HTML template containing HTML and proprietary server-side instructions. If an HTML template contains the server-side instruction $SCRIPT(), with proper parameters, the server runs the specified script. In the outgoing HTML, the entire $SCRIPT instruction is replaced by the script's output. If the script's output is valid HTML, it is visible in the browser. For an example of $SCRIPT() usage, see Example: Using $SCRIPT() in HTML below.
To view an HTML template, browse to an SBM URL containing the parameter "Template=name", where "name" is the file name of the template, excluding the "htm" extension. For example, the URL for the About page is as follows:
http://business_manager_server/tmtrack/tmtrack.dll?
→StdPage&Template=about
If the HTML template contains a $SCRIPT tag, the output of that script is visible on the page.
Any optional parameters following the name/ID are inserted into a Dictionary object which is passed to the script. The Dictionary of optional parameters is accessible from within the script as "Shell.Params." Shell.Params supports the methods and properties of a VBScript Dictionary.
The value of the Nth optional parameter is associated with a key called "paramN." For example, the first optional parameter is "param1."
Create a script called myScript:
dim sText1, sText2 sText1 = Shell.Params.Item( "param1" ) sText2 = Shell.Params.Item( "param2" ) Call Ext.WriteStream( "<HTML>") Call Ext.WriteStream( "<HEAD><TITLE>Script Test</TITLE></HEAD>" ) Call Ext.WriteStream( "<BODY>" ) Call Ext.WriteStream( "Param1: " ) Call Ext.WriteStream( "<H2>" & sText1 & "</H2>" ) Call Ext.WriteStream( "<BR>" ) Call Ext.WriteStream( "Param2: " ) Call Ext.WriteStream( "<H2>" & sText2 & "</H2>" ) Call Ext.WriteStream( "<BR>" ) Call Ext.WriteStream( "</BODY>" ) Call Ext.WriteStream( "</HTML>" )
Create an HTML file called scripttest.htm, and add the following text to it:
$SCRIPT( myScript, Godzilla, King Kong )
Save this file in the SBM installation templates directory.
Use the following URL to test the $SCRIPT mechanism:
http://business_manager_server/tmtrack/tmtrack.dll?
→StdPage&Template=scripttest
Copyright © 2007–2015 Serena Software, Inc. All rights reserved.