[ Previous ] [ Contents ] [ Index ] [ Next ]

ADP Syntax

There are three different syntaxes you can use to embed a Tcl script into an HTML page. Insert Tcl commands between any of the following sets of HTML tags:

The contents of the script are interpreted using the Tcl interpreter. The result is not inserted into the page, however. You can use the ns_puts Tcl function to put content into the page.

The language=tcl attribute is optional. Future enhancements to ADPs will include the capability to embed scripts in other scripting languages, and you will be able to configure the default language. If the language attribute is set to anything except tcl, the script will not be processed, and a warning will be written to the log file.

The runat=server attribute is required. If this attribute is missing, the script will not be processed. The runat=server attribute is necessary so that client-side scripts are not executed accidentally.

The stream=on attribute is optional. If it is included, all output for the rest of the page is streamed out to the browser as soon as it's ready. Streaming is useful when your script may take a long time to complete (such as a complex database query). Content is output to the page gradually as the script is running. One disadvantage of streaming is that the server cannot return a Content-length header with the response. Content-length can speed up the connection, especially if the connection is going through a proxy server.

This syntax is evaluated exactly the same as the first syntax, above, except that you cannot specify any of the attributes. The language=Tcl and runat=server attributes are implied. Streaming is not allowed with this syntax, but output within this syntax will be streamed if streaming was turned on in a previous script. This syntax can be used inside HTML tags.

The Tcl commands within these tags are evaluated as the argument to an ns_puts command, which inserts the results into the page. This syntax can be used inside HTML tags.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.