JavaScript client-side includes! ---------->
The jsInclude macro renders the object to text, escapes the text, saves it to a file, and returns the <script src=...> tag.

A JavaScript client-side include (JSI) is a chunk of content that is generated by an included JavaScript source file. This allows a page to be assembled from pieces, and updated by parts, without using frames and without having to regenerate the entire page every time it is modified.

Instead, the included JavaScript source file is regenerated separately, and included by the client's browser.

In effect, JSI gives you the flexibility of SSI on the client side!

So this page is generated with a tabular structure, but in place of the banner, it has a script tag to include the JavaScript file that will generate the HTML for the banner:

<script language='JavaScript' src='banner.js'></script>

In place of the navbar and the right column, it has similar script tags.

Creating JavaScript Includes

To create a JavaScript Include, insert the JSInclude macro in your source text or template where you want the content to be included. The macro takes one parameter: the ODB address of the content to be rendered and included.

If the address is in the same website as the page being rendered, only one JSI source file will be generated for a given chunk of content, and it will be linked by relative URLs from each page that includes it. Otherwise, a file will be generated at the same location as the page that is being rendered.

In addition, the macro will not re-render the source content into the JSI include file unless the source content has changed (or the file doesn't exist, of course).

For example, the fake news column on the right is included in this page with the following macro:

{JSInclude( @includeBits^.news )}

The JSInclude macro is part of the JavaScript Suite.


Copyright © 1998, 1999 by Samuel Reynolds. All rights reserved. Last modified 1999/05/23.
Built with Frontier v.6.0 on Macintosh OS 8.1 on 1999/05/23.