8.1 Hello World

Most programming languages start with a "Hello world" example, so why break with tradition? Here's our example:


  <SCRIPT LANGUAGE=vortex>

  <A NAME=main>                      <!-- Function declaration -->
    <BODY BGCOLOR=white>             <!-- HTML output -->
      Hello world!
      Your address is: $REMOTE_ADDR  <!-- Variables use $-signs -->
    </BODY>
  </A>

  </SCRIPT>

If we copy this to a file named texis/scripts/example in our installation dir (eg. /usr/local/morph3 or C:\morph3 , we can run it via our browser to see the results:

Netscape: Untitled

File Edit View Go Communicator
Location:
Hello world! Your address is: 1.2.3.4

What exactly happened?

  1. We entered the URL http://www.mysite.com/cgi-bin/texis/example in our browser and hit Enter. (Note: obviously, you'll need to replace www.mysite.com with your server's name.)

  2. The web server invoked texis , which looked at the URL and ran the script example . Since this is the very first time the script has been run, it was automatically compiled into the object file example.vtx . Vortex then started running the script at the default entry function main .

  3. The main function displays the "Hello world" HTML and the value of the variable $REMOTE_ADDR .

  4. The main function and the Vortex script end. texis exits, and our browser disconnects from the web server.

Let's look at the syntax of our example script in more detail...

Back: Vortex Introduction Next: Script Syntax
Copyright © 2024 Thunderstone Software LLC. All rights reserved.