Bo Larsson's Internet Server Software

Bo Larsson's Internet Server Software
All Contents Copyright 1997-2020 by Bo Larsson - Send questions or comments to: admin@bliss.seagull.net
Table of Contents
Last updated 18 Jan 97
Welcome!

Perl CGI Scripts

guestbook 970118 NEW!
classifieds 970115 NEW!
search 961211
table 961201
textrotate 961121
rotater 961119
navigate 961117
redirect 961111
pcounter 961110
mailsend 961110
yourhost 961110
youraddress 961110

Java Applets

jclock 961204 NEW!
jcounter 961114

Links to Other Sites

Fisher's CGI Talk NEW!
JemTek CGI C Library
Dream Catchers CGI Scripts
Web Engineer's Toolbox
cgi-lib.pl Home Page
Common Gateway Interface
CGI Made Really Easy
CGI Programmer's Reference
Matt's Script Archive
Netamorphix CGI Page
Selena Sol's Archive

textrotate 961121

view the source

show me some examples

show me the html source for the examples

Have you seen those "random" URL scripts that take you to a random URL? Or, how about those fortune cookie scripts? They're kind of cool, but most are written in a way that cannot guarantee that all links or fortunes will ever be displayed, or that they will be displayed an equal number of times. I wanted a script like this, but I wanted to make sure that each piece of text would be displayed an equal number of times, and that the same text wouldn't be repeated until all the items had been displayed. Instead of writing a script that does everything randomly, I decided to just do things serially.

What it does

The textrotate script basically returns the next line in a specified file. It then puts the first line at the end of the file. Can you think of any cool uses for a script like this?

What's it good for

Say for example that you want a quotable quote to be displayed each time someone visited your page, and you want the quote to be different each time. How do you do this? Check out the examples given here. They will show you how by using the textrotate script in different ways. By the way, you'll need server side includes to do this cool stuff.