decodeURL ( encoded-string ) |
Returns: any type | Location: Built-in | ||||
Returns the original item specified by encoded-string. The returned item may be any type, including a list if it was encoded using encodeURL(). This function is not necessary in most cases except when working with lists, as WebSiphon automatically decodes other types of encoded data instantiated using GET/POST arguments. In some earlier versions of WebSiphon list variables were automatically decoded as with other types of variable data, but this functionality was altered to prevent the potential of using this feature to launch a denial-of-service attack. Thus, it is necessary that list data be manually decoded before use as a list variable. Example: my_string = "A%20B%20C%20D"; print decodeURL(my_string); >> A B C D my_list = [1 2 3 4]; print decodeURL(encodeURL(my_list)); >> 1 2 3 4 See Also: |
encodeURL ( item ) |
Returns: string | Location: Built-in | ||||
Returns a string containing the encoded contents of the item parameter which is suitable for use as a legal URL argument. If item is a list it will be encoded in a special manner which preserves the integrity of data within a list, including lists which contain sublists. Example: my_string = "A B C D"; print encodeURL(my_string); >> A%20B%20C%20D my_list = [1 2 3 4]; print encodeURL(my_list); >> %5C[1%5C|2%5C|3%5C|4%5C] See Also: |
insertCounter ( counter-name ) |
Returns: integer | Location: WebUtils.lib | ||||
Increments and returns the page counter counter-name. If the specified counter does not exist, it is created and a value of 1 will be returned. Use this function to easily insert counters in your pages. Passing the built-in variable template_uri as the counter name will provide a unique name for any page on your site, so you can use it in a standard site footer include file to record counters for every page on your site served by WebSiphon. Examples: This page has been accessed {insertCounter(template_uri)} times. >> This page has been accessed 24 times. print insertCounter("My Home Page Counter"); >> 1 See Also: |
redirectClient ( location ) |
Returns: null | Location: Built-in | ||||
Immediately redirects the client to the URL specified in the location parameter. This function will cease further execution of the template. Though some browsers will properly redirect with a relative URL, most do not. Use a fully qualified URL to ensure maximum browser compatibility. Examples:
|
removeCounter ( counter-name ) |
Returns: integer | Location: WebUtils.lib | ||||
Removes the page counter whose exact name is counter-name, and returns the value that it held. Example: print insertCounter(template_uri) & " "; print removeCounter(template_uri); >> 24 24 See Also: |
resetCounter ( counter-name ) |
Returns: null | Location: WebUtils.lib | ||||
Resets the value of the page counter whose exact name is counter-name to zero. If the specified counter does not exist, it is created and set to the value zero. Example: print insertCounter(template_uri) & " "; resetCounter(template_uri); print insertCounter(template_uri); >> 24 0 See Also: |
setCounter ( counter-name, value ) |
Returns: null | Location: WebUtils.lib | ||||||
Sets the page counter whose exact name is counter-name to the value specified. If the specified counter does not exist, it is created. Example: print insertCounter(template_uri) & " "; setCounter(template_uri, 1000); print insertCounter(template_uri); >> 24 1001 See Also: |
stripHTML ( html-text ) |
Returns: string | Location: WebUtils.lib | ||||
This function will strip all HTML tags from the text string passed in html-text. It will insert three carriage returns after the title of the document, two carriage returns for each paragraph tag, and a single carriage return for each line break tag. All other tags are ignored. |
appendHeader ( http-header ) |
Returns: null | Location: Built-in | ||||
Appends the string passed in http-header to the standard HTTP response header that WebSiphon includes with all returned results. A trailing CRLF will be added if you do not provide one in the string. Example: appendHeader("X-MyHeader: 12345"); |
sendPartial ( ) |
Returns: null | Location: Built-in |
This function sends the current HTML output back to the client, while the template is still executing. Using send partial allows you to improve the perceived server performance by breaking large portions of a returned page into smaller chunks that the client can view as each piece is returned. Be careful not to use send partial too much, whereas the overhead of returning multiple chunks of a page actually outweights the perceived performance gain. There is no set rule as to how often to use send partial, so you may wish to try several different combinations to find the best match. Hint: Call sendPartial() just before performing database queries to return the results page immediately, with the actual search results returned as they are completed. |
setExpiresDelay ( delay-seconds ) |
Returns: null | Location: Built-in | ||||
Sets the expiration delay of the returned page, specified in seconds. The delay is added to the current time and used in the "Expires:" HTTP response header. The default expiration delay WebSiphon uses for all templates is 0, indicating that the returned page should never be cached. You may set the global expiration delay by choosing "Preferences..." from the Edit menu availble in the WebSiphon application. Example: setExpiresDelay(1800); // the page will expire in 30 minutes |
setMIMEType ( mime-type ) |
Returns: null | Location: Built-in | ||||
Changes the MIME type of the returned document to the string specified in mime-type. Use this function when returning any item that is not "text/html", such as images or other binary files. Examples:
|
authorizeClient ( realm-name [, return-message ]) |
Location: Built-in | |||||||
When called, this function will return a standard authentication challenge to the client accessing the page, with the realm specified in realm-name. After the user provides a username and password, they will be available using the built-in variables username and password for verification purposes. Depending on the browser being used to access your site, the username and password fields may or may not be case-sensitive. If you wish to ensure that the username and password are not case-sensitive, use the uppercase() or lowercase() functions prior to checking for access. The example shown below demonstrates this functionality. The string passed in the return-message parameter will be returned to the client only if they do not to enter a valid username/password combination. If this optional parameter is not specified, the client will be returned the message, "Document contains no data" or possibly a blank page with some browsers. Examples: |
removeCookie ( cookie-name [, domain, path ]) |
Returns: null | Location: Built-in | ||||||||
This function will remove the defined HTTP cookie whose name is specified in cookie-name from the client's web browser. The domain and path parameters must match the values used when the cookie was originally created. If their values are not specified, the host name of the server and the path to the running template is used. If you did not specify these parameters when the cookie was set, you will not need to specify them for removal. WebSiphon's implementation of HTTP cookie support conforms with Netscape's cookie specification at http://www.netscape.com/newsref/std/cookie_spec.html. See Also: |
setCookie ( cookie-name, cookie-value [, domain, path, expires, require-ssl ]) |
Returns: null | Location: Built-in | ||||||||||||||
This function will define or modify a HTTP cookie whose name is cookie-name. The value stored by the cookie is specified in the cookie-value parameter and is encoded for you so you can safely store list values. Once a cookie has been defined it is available for use with each request as with other runtime session variables, such as GET or POST arguments. If the optional domain or path parameters are provided, a web browser will only send the cookie to a URL that matches the specified values. If these parameters are not specified, the host name of the server and the path to the running template are used as default. In most cases you will not need to use the domain and path parameters at all, but may be helpful in some runtime scenarios. The expires parameter designates an expiration date for the cookie which must be specified as an formatRFC1123() date, with the slight variation that the field delimiters within the date-portion of the string must be dashes rather than spaces. If this optional parameter is not specified, the cookie will only last for the user's current browsing session (ie. temporary; until they quit and relaunch their web browser). Finally, if the require-ssl parameter is set to true, a web browser will only send the cookie if the connection is transmitted using SSL. WebSiphon's implementation of HTTP cookie support conforms with Netscape's cookie specification posted at http://www.netscape.com/newsref/std/cookie_spec.html. See Also: Examples:
|
Please see http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.2 for more information on multipart/form-data.
Example Form:
<FORM action="{template_name}" enctype="multipart/form-data" method="post"> What is your name? <INPUT type="text" name="submit-name"><BR> What files are you sending? <INPUT type="file" name="my_file"><BR> <INPUT type="submit" value="Send"> <INPUT type="reset"> </FORM>
Example Script:
<< file_stat = ulFileStatus(my_file); case file_stat of 1: print "file too large"; // file was too large 2: print "invalid file"; // file was invalid end case; if (file_stat = 0) then file_name = ulFileName(my_file); // set file path to current file directory new_path = template_path; // save new image ulSaveFile(my_file, new_path, file_name); print ulFileSize(my_file); print ulContentType(my_file); end if; >>
ulContentType ( form-ref ) |
Returns: string | Location: Built-in | ||||
When provided with a reference to an uploaded file, the MIME type of the file will be returned as a string. Keep in mind that this is not necessarily the correct MIME type but only what was sent by the web browser. For instance, MSIE will send a MIME type of "text/plain" for any file whose name contained the "#" character or did not contain a suffix mapping, ie. ".gif", ".jpg" etc. In other words: You may not be able to rely on this value. |
ulFileName ulFileName ( form-ref ) |
Returns: string | Location: Built-in | ||||
When provided with a form-ref, the original file name as sent by the web browser will be returned. If the remote user agent is a Windows machines this is likely the full path to the file, ie. "C:\\some\path\file.gif". Generally Mac OS browsers will include only the filename itself. |
ulFileSize ulFileSize ( form-ref ) |
Returns: string | Location: Built-in | ||||
Returns the size of uploaded file form-ref in bytes. |
ulFileStatus ( form-ref ) |
Returns: integer | Location: Built-in | |||||||||||||
This function is used to determine the status of an HTTP file upload in requests which include multipart/form-data. When provided a form-ref which matches the name attribute of a file input entity included in the HTTP request, this function returns a result code which indicates the status of the received file upload. Possible return values include:
Example: // if trouble, output file upload status to console file_stat = ulFileStatus(import_data); if (file_stat != 0) then case file_stat of (-1): err_msg = "upload missing"; 1: err_msg = "upload too large"; 2: err_msg = "upload was corrupt"; otherwise: err_message = "unknown error"; end case; appendLog(file_stat & ": " & err_msg); end if; |
ulSaveFile ( form-ref, path [, new-filename ]) |
Returns: string | Location: Built-in | ||||||||
When processing a multi-part encoded POST with a file upload present, the field name you chose for the file upload will contain an ID. This is the ID you pass into 'id' so that WebSiphon knows what file you wish to work with. 'path' should be the path to a folder where you wish the file to be placed. If you include the optional 'new_filename' parameter, the file will be renamed to this (from its name as uploaded by the user) Based on the ID value passed in with the file POST arg, allows saving of file to a permanent location. |