8.3 URL Syntax

Since Vortex runs as a CGI program, its URL syntax uses CGI standards. (If you're not familiar with it, you might wish to read an overview of CGI, particularly what common CGI variables the Web server sets.)

Basic syntax

A simple Vortex URL looks like this:


  http://www.mysite.com/cgi-bin/texis/example

The first part, http://www.mysite.com/ , simply refers to whatever Web server Vortex is installed on.

Next, /cgi-bin/texis tells the Web server to run texis - the program that runs Vortex scripts. Programs in the CGI directory cgi-bin (usually a subdirectory of the Web server root) are executed by the Web server when a URL starting with /cgi-bin is browsed.

Finally, /example is the URL path to the Vortex script. This tells Vortex what script to run - example in this case - and to look for it relative to the texis/scripts subdirectory (aka ScriptRoot ) of our installation directory.

Default script

If the script path (/example ) is missing from the URL, Vortex will execute the default script /usr/local/morph3/texis/testdb/index . This helps capture URLs mis-typed by the user instead of presenting an error message.

Note that all of the info on where texis is, what script to execute, and where the script is located, is derived from the URL and CGI environment variables set by the server. This eliminates the need for an additional config file.

The $url variable

One of the most common things a Vortex script does is generate a URL back to itself. For example, a search script may show a list of hits, with each hit linked back to the script to show details on a given result.

This is where the special variable $url is handy. It is automatically set by Vortex to a full-path URL to re-invoke the current script. So a script could link back to itself with the following code snippet:


  <A HREF=$url>Details</A>

Not only is this easier than writing out the URL by hand, it is portable: if we rename the script or move it to another server, the script's links do not need to be re-written. The $url variable is also very important because it contains state information, as we'll see in the section on State nbsp;Retention .

There are more parts to a Vortex URL that we'll discuss later, as we need them.

Back: Script Syntax Next: User Input
Copyright © 2024 Thunderstone Software LLC. All rights reserved.