How NeoWebScripts Are Invoked

NeoWebScripts™ are embedded directly into HTML files.

When a NeoWebScript™-enabled webserver retrieves a page in response to an HTTP request, if the webpage meets the criteria for execution of embedded NeoWebScripts™r;, any NeoWebScripts™ that are present in the webpage are executed sequentially as the webpage is transmitted, and the results of those script executions create some of the contents of the webpage "on the fly" as is served out.

By default, HTML files are NeoWebScript™-enabled if you allow server-side includes for that file. (This behavior can be overridden, or other extensions also set up to trigger NeoWebScript™ execution using the AddType directive within the webserver configuration file, or via the mime.types file.)

The file can contain all of the usual sort of text and HTML directives.

A special comment type, patterned after the special comment type used to activate server-side includes, is used to trigger NeoWebScript™ execution.

Let's look at a simple webpage:


<! Sample NeoWebScript™ Webpage -->

<title>Sample NeoWebScript Webpage</title>
<h1>Sample NeoWebScript™ Webpage</h1>

This is a sample webpage containing embedded NeoWebScript™ directives.
<P>
The current server time is <!--#neoscript eval='html [clock format [clock seconds]]' -->
<P>
Thanks for visiting!

In the above example, the embedded NeoWebScript™ directive begins with

<!--#neoscript

...followed by one or more tags of the form tag=value.

The eval tag causes the specified code to be evaluated as a NeoWebScript™. The script can then make calls to html to emit HTML. In this case, it says format the current time into a human readable time (clock format). For the clock value, use the current system time (clock seconds).

Other NeoWebScript™ Tags

In addition to the eval tag, a number of other tags are available:

The var tag says that its corresponding value is the name of a global variable or element within a global array in the NeoWebScript™ interpreter. In this case, the value is fetched and emitted into the HTML being sent to the user.

The expr tag causes its value to be evaluated as a NeoWebScript™ expression. The result of the expression is emitted into the HTML page that's being transmitted.

The return tag causes its value to be evaluated as a NeoWebScript™ expression. The result of the expression is emitted into the HTML page that's being transmitted. So the example above could be simplified into:

The current server time is <!--#neoscript return='clock format [clock seconds]' -->
Any number of NeoWebScript™ calls can be embedded into a webpage, and multiple tags may be present in any call. Execution of the NeoWebScript™ calls in a webpage proceeds in order from top to bottom, and evaluation of multiple tags within an embedded NeoWebScript™ call proceeds from left to right. State is retained throughout the execution of NeoWebScript™ in constructing the page, so, for example, global variables and procedures defined in the first part are accessible from the latter ones. Of course, all this information is discarded once the page has been sent.