MSA - Matt's Script Archive SurveyFactory - Create and publish online web surveys
 Matt's Script Archive: Random Text: ReadmeView All Readme Files @ MSA
 
  Other sites by Matt:
 FormMail.com
  - hosted form processor
 SurveyFactory
  - hosted survey software
 CGI Resource Index
  - 3,000+ Perl Scripts!
 PHP Resource Index
  - 2,000+ PHP Scripts!
 chumpsoft, inc.
  - online survey software


  Matt's Script Archive
    FormMail
    Guestbook
    WWWBoard
    Simple Search
    Counter
    TextCounter
    Random Text
      > Readme 
      Download
      FAQ
    TextClock
    Free for all Links
    Random Link
    HTTP Cookie Library
    Countdown
    Random Image
    SSI Random Image
    TextCounter C++
    TextClock C++

Table of Contents
Select from the following table of contents to jump to a specific area within this README file. This is a HTML version of the README file distributed with Random Text.
Copyright and Header
Random TextVersion 1.0
Copyright 1996-2002 Matt Wrightmattw@scriptarchive.com
Created 07/13/96Last Modified 07/13/96
Matt's Script Archive, Inc.:http://www.scriptarchive.com/

If you run into any problems while trying to configure this scripts, help is available. The steps you should take to get the fastest results, are:
      1) Read this file thoroughly.
      2) Consult the Matt's Script Archive Frequently Asked Questions:
          http://www.scriptarchive.com/faq/
      3) If you are still having difficulty installing this script,
          you may wish to look at the resources listed here:
          http://www.scriptarchive.com/help/

Hopefully that will be able to help you solve your problems. Due to time constraints I can no longer offer technical support for this code.

COPYRIGHT NOTICE:
Copyright 1995 - 2002 Matthew M. Wright All Rights Reserved.

Random Text may be used and modified free of charge by anyone so long as this copyright notice and the comments above remain intact. By using this code you agree to indemnify Matthew M. Wright from any liability that might arise from its use.

Selling the code for this program without prior written consent is expressly forbidden. In other words, please ask first before you try and make money off of my program.

Obtain permission before redistributing this software over the Internet or in any other medium. In all cases copyright and header must remain intact.
Overview
Random Text is a program which takes a plain text file, which contains a series of phrases, quotes, lines of text, etc... and a delimiter (the character(s) which separate each entry) and will randomly choose one of the phrases and display it on your web page. This requires the use of Server Side Includes, which you can read more about at the FAQ URL listed above.

There are two files included with this script:

1. README - This file; includes detailed installation instructions.
2. rand_text.pl - The Perl script which generates the random phrase and displays it on your web page.

The rand_text.pl file has two variables which must be modified. You then must place this file in a special executable directory (usually called cgi-bin) or rename it to end with a .cgi extension if your server is set up that way.
rand_text.pl
There are two variables in this program which must be modified:
 
$random_file = "/path/to/random.txt";
This variable points to the location of the file which contains the phrases which you wish to have randomly displayed. This shoul dbe a system path and not a URL.

$delimiter = "\n\%\%\n";
This specifies what separates each record. If you leave it as the default, your $random_file database should look like:

Phrase one would go here.
   As much white space or formatting as you want.
%%
Second Phrase would go here.
%%
And the next
   Second line of the next.
%%
Etc...


If you set $delimiter = "\n";, then the script would assume that every line is a separate phrase and randomize the file based on that.
How To Implement This In Your Web Pages
This script must be called as a Server Side Include, or it can also be called on a page by itself (however that is not as nice looking.) Below are some examples of how to call this program:

   <!--#exec cgi="/url/path/to/rand_text.cgi"-->

That would simply call the program from a Server Side Include and the Random Text woud appear in that location on your web page.
History
Version 1.0 07/13/95 - First Version Released.

 

FormMail.com :: HTML Form to Email Processor
[ Linking to MSA | Advertising Opportunities | Contact Matt ]
© 1995 - 2009 Matt Wright and Matt's Script Archive, Inc.