Return CGI Library
Sequence is a simple tool that allows you to generate witty sayings, randomized advertisements, or other lines of HTML code that change
between "hits" on a page.
Usage of the tool is very simple. You need to create a file that has the "random" lines of HTML in it. The gadget will pick ONE LINE
from this file.
The magic line to include in your HTML page is:
<!--#include virtual="/cgi-bin/sequence" -->
or
<!--#include virtual="/cgi-bin/sequence/path/to/file.rnd" -->
If you use a line similar to the first include, the gadget will choose the source file for you.
The form of the second include line allows you to specify the source file.
If you choose specify the .rnd file in the include statement, you can easily use the same source file for many pages. To do this, you
need to replace /path/to/file.rnd with the URI of your .rnd file.
So what is a URI?
I don't know how URI is formally defined, but for this page, we're going to define it as the part of a URL after the "http://host"
part. So the URI for this page is /gadgets/sequence.html. This is not a .rnd file. We have to specify the URI of a .rnd file.
Suppose we have a file called random.rnd in the same directory as sequence.html. (We do, actually.) The URI for the random.rnd file
must be /gadgets/random.rnd. We know this because we can say
http://baremetal.com/gadgets/random.rnd and the .rnd file will appear in our web browser. (Go ahead, try the link!)
Here is an html example that picks lines from the file with the path /gadgets/random.rnd:
< START EXAMPLE >
[an error occurred while processing this directive]
|
< /END EXAMPLE >
This example is generated using the following include:
<--!#include virtual="/cgi-bin/sequence/gadgets/random.rnd" -->
The best way to check the URI you are using is to ask the webserver to give the file to you. This page is hosted on the baremetal.com
server, so to check the URI in the example above, you'd use the following:
/gadgets/random.rnd.
If you decide to let the gadget choose the file, you must create a .rnd file in the same directory as the page you include the gadget
on. The name of the file is the name of the page, but with the ".html" or (".htm") extension changed to ".rnd". (The source file for
the "index.html" page, for example, would be in "index.rnd")
The Source File Contents
The gadget picks one line of the .rnd file and puts it into your html document. Each line in your .rnd file should contain one of the
html strings you want inserted into the document.
Here is /gadgets/random.rnd from examples on this page:
<b>Line</b> 1
<i>Line</i> 2
<img src="/images/bmdcomp.gif" alt=" Computer " /> 3
Honk if you love peace and quiet!
For those interested, the old Islandnet format is supported for backwards compatability.
|