Larry Israel Photo

Content Rotator

Perl Script by Larry Israel
Version 1.0 — December 18, 2002

Description

Content Rotator is photo of the day script. It delivers a different block of text (HTML) each day to your web pages via SSI (server-side include). It was designed to rotate images and the HTML code surrounding the <img> tag, but it can be used to rotate any type of content. When used on multiple web pages, Content Rotator can be configured to deliver different output to each page so that every page displays a different photo.

Daily rotation discourages visitors from reloading the page and provides consistency for all visitors (in case someone wants to tell a friend to look at the picture on some page). The script outputs the code blocks in sequential order, not at random, which gives you control over the order in which they will appear. I wrote this script because I couldn’t find an existing script that did what I wanted.

Content Rotator is freeware. If you use it, it would be nice to hear about it. Please send me the URL, I’m curious to see how it’s being used. If you encounter a problem with the script, please let me know. Maybe I’ll fix it. You’re welcome to send suggestions or mods. If I like them, I’ll incorporate them.

Warning: This script is not intended for use on a high-traffic site.

Narrative Instructions

Place an SSI at the spot on your web page(s) where you want the HTML output to be located. Alternatively, you could put a link on your site that goes directly to the script, if you want to rotate complete web pages.

The script does not generate any HTML. You must put all the HTML output into the rotate_output.txt file. Each day, the script delivers the same block of code to everyone who visits that page. The output rotates daily, in sequence, based on the number you assign to each code block in the rotate_output.txt file. Once the code blocks have all been used, the script begins again at the first (001). The script stores data about the rotation in the rotate_data.txt file.

More-detailed instructions and documentation are included in the script.

Download

Download the zip file. It contains the script (rotate.cgi) and an example output file (rotate_output.txt):

The script file (by itself):

If you like this script, please rate it at the CGI Resource Index.