11.3 Using a Module

Now that we've created a module lookfeel , we can use it in our main application script. Let's go back to our usual file example in the HTML document tree, and edit it like this:


  <SCRIPT LANGUAGE=vortex>

  <USES lookfeel>

  <A NAME=main PUBLIC>
    <look title="Introduction">
    This is our main application page.
    </look>
  </A>

  </SCRIPT>

We put the directive <USES> at the top of the script. This tells Vortex that we're going to use the module lookfeel in our script and to include it: we now have access to its functions. The entire example application is still compiled into a single example.vtx file for speed however: the library isn't constantly referred to at run-time.

We save this to example , and run it from our browser. We get the following output:

Netscape: Introduction

File Edit View Go Communicator
Location:
Introduction

Introduction

This is our main application page.


Back to home page

Our main function calls the <look> and </look> functions to produce its header HTML. These don't exist in the example script itself, but they do in the lookfeel module we included.

Now we've got a clean example file without the clutter of the look and feel functions; we can dedicate it to high-level application code. Moreover, other application scripts can share these functions just as easily.

The real power of modules comes down the road, however (next page):

Back: Inserting a Module Next: Checking Out a Module
Copyright © 2024 Thunderstone Software LLC. All rights reserved.