Link back to main EIU page
A to Z IndexApply Online with EIU
Alumni and Friends Parents Faculty and Staff EIU Students
Eastern Illinois University - Charleston, IL
 


Common Questions

EIU Logo
 

PALETTE: Instructions on using our CGI scripts in your code
 

NAME

palette - recurrently or randomly displays or selects one file from a collection of files from within an HTML document.

SYNOPSIS

<IMG SRC='/cgi-bin/palette?<file-collection>[+[options]]'>
or
<A HREF='/cgi-bin/palette?<file-collection>[+[options]]'>...</a>;>

where the <file-collection> specifies an address.number.type of files in the collection and where 'options' includes any order of the characters [+dhmruw]. Brackets [] are used in this document to denote optional values and are not used in the actual syntax.

AVAILABILITY

http://www.eiu.edu • http://www.ux1.eiu.edu • http://www.pen.eiu.edu • http://www.research.eiu.edu

DESCRIPTION

The script allows web developers to periodically or randomly display an image from a collection of images in any HTML document. The script requires all of the images to be located in a common directory, to be of the same type (e.g. gif or jpeg), and to be named by a format that includes a common collection name and a unique ID value.

OPTIONS

Any combination of options is prefixed by a single '+' and includes any order of the following case-sensitive letters.

++

Display the current documentation and disable all other actions of the script.

+d

Daily changes a target file every day of the month from a sequential selection list.

+h

Hourly changes a target file every hour of the 24-hour day from a sequential selection list.

+m

Monthly changes a target file every month of the year from a sequential selection list.

+r

Randomly changes a target file from a sequential selection list.

+u

Minutely (default) changes a target file every minute of the hour from a sequential selection list.

+w

Weekly changes a target file every day of the week from a sequential selection list.

USAGE

To sequentially display every minute of the hour (the default, same as the +u option) one of the following four gif-type images, rename each of the files to have both a common collection name (e.g., palette.ID.gif) and a unique identification (ID) number placed between the collection name and file type.

1 palette.00.gif 2 palette.01.gif 3 palette.02.gif 4 palette.03.gif

The ID numbers in any collection must begin with a value of zero (0). Additionally, all ID numbers must be 'padded' with zeros if the total number of digits in the ID is less than 2. This is why there are extra zeros in the above filenames. Next, move all of the images into a common location (directory). Finally, create one of the following image tags in an HTML document.

<IMG SRC='/cgi-bin/palette?/private/palette.4.gif'>
or
<IMG SRC='/cgi-bin/palette?private/palette.4.gif'>
or
<IMG SRC='/cgi-bin/palette?palette.4.gif'>

Note the differences in the string of characters after the question mark. The '/private/' string in the first example indicates the collection is located in a sub-directory at the server's root, whereas the 'private/' string in the second shows the collection is now located in a sub-directory at the current location of the HTML document. The absence of a path in the last example indicates that the collection is located in the same directory as the current HTML document. In all three cases, the image collection will begin with 'palette' name and end with a 'gif' type extension. The number in-between the name and type specifies that there are a total of four images in the collection for random selection. The first image must have the name palette.00.gif and the last one will have the name palette.03.gif. Change the ID number to 2 in the above examples to limit the selection to just two images (i.e., palette.00.gif and palette.01.gif).

4 recurrently-selected (every minute) image

The image above was randomly selected from the collection of four images that were specified by the first of the three <IMG SRC='...'> tag examples. Hold down the Shift key and press the Reload (Refresh) button to see a different random image. This will force the client's browser to get a new copy of the image from the server instead of using a locally-cached copy. The process may have to be repeated for the image to change to a different figure.

Creating a random link to one of the following four html-type documents, rename each of the files to have both a common collection name (e.g., palette.ID.html) and a unique identification (ID) number placed between the collection name and file type.

palette.00.html palette.01.html palette.02.html palette.03.html

The ID numbers in any collection must begin with a value of zero (0). Additionally, all ID numbers must be 'padded' with zeros if the total number of digits in the ID is less than 2. This is why there are extra zeros in the above filenames. Next, move all of the documents into a common location (directory). Finally, create one of the following anchor tags in an HTML document.

<A HREF='/cgi-bin/palette?/private/palette.4.html+r'>...</a>
or
<A HREF='/cgi-bin/palette?private/palette.4.html+r'>...</a>
or
<A HREF='/cgi-bin/palette?palette.4.html+r'>...</a>

Note the differences in the string of characters after the question mark. The '/private/' string in the first example indicates the collection is located in a sub-directory at the server's root, whereas the 'private/' string in the second shows the collection is now located in a sub-directory at the current location of the HTML document. The absence of a path in the last example indicates that the collection is located in the same directory as the current HTML document. In all three cases, the document collection will begin with 'palette' name and end with a 'html' type extension. The number in-between the name and type specifies that there are a total of four documents in the collection for random selection. The first document must have the name palette.00.html and the last one will have the name palette.03.html. Change the ID number to 2 in the above examples to limit the selection to just two documents (i.e., palette.00.html and palette.01.html).

randomly-selected document link

The link above was randomly selected from the collection of four documents that were specified by the first of the three <A HREF='...'> tag examples. While at the the 'linked' document, hold down the Shift key and press the Reload (Refresh) button to see a different random document. Holding down the Shift key will force the client's browser to get a new copy of the document from the server instead of using a locally-cached copy. The process may have to be repeated for the document to change to a different file.

FILES

There are no files directly associated with the operation of the script other than those in the image collection referenced by the developer in the <IMG SRC='...'> tag.

SEE ALSO

CGI Suite (Collection of General Purpose Scripts)

DIAGNOSTICS

palette was developed to handle all types of user-, owner-, and server-related errors. However, the script will send back to the client a 'broken' image for all errors that are related to nonexistent image files.

WARNINGS

Using an <IMG SRC='...'> tag that references a non-image collection will produce a 'broken' image on the client's browser. File selection is only pseudo-random because the seeding of the random number generator (srand (time ^ $$)) was chosen for speed.

NOTES

palette has been tested without problem on Windows NT Workstations with Netscape Communicator 4.x and Microsoft Internet Explorer 3.x web browsers. Older versions of these and other browsers that do not support JavaScript and Cascading Style Sheets will not display the response messages and documentation as fully designed. This browser limitation, however, has no effect on the function of the script.

BUGS

There are no known bugs in the current version.

AUTHOR

Gerald Charles Wagner. Version 2.0 (Release June 1999).

  Eastern Illinois University :: 600 Lincoln Avenue :: Charleston, IL 61920-3099 :: 217-581-5000 :: Contact Us :: Maps & Directions :: Text Only
Privacy Statement :: Confidentiality Statement :: Mission Statement :: Federal and State Mandated Information :: Alert EIU