Random Text Script Download

Download the Random Text script to display random quotes, tips, or text snippets on your website using Server Side Includes.

Version 1.0 | Perl CGI Script

Download Options

TAR.GZ Archive

Unix/Linux compressed archive

Download .tar.gz

~4.2 KB

ZIP Archive

Windows/Mac compressed archive

Download .zip

~4.8 KB

Files Included

Filename Description View
README Installation instructions and documentation View
rand_text.pl Main Random Text CGI script View
quotes.txt Sample text file with example quotes View
Tip: The quotes.txt file is a sample. Create your own text files with custom quotes, tips, or snippets for your website.

Installation Notes

Quick Start Guide
  1. Download either the .tar.gz or .zip archive
  2. Extract the archive contents to your server
  3. Upload rand_text.pl to your cgi-bin directory
  4. Upload quotes.txt to a web-accessible directory
  5. Set permissions: chmod 755 rand_text.pl
  6. Edit rand_text.pl to set the path to your text file
  7. Add to your .shtml pages: <!--#exec cgi="/cgi-bin/rand_text.pl"-->
  8. Test and enjoy random quotes on your site!
Configuration

Edit the following variables in rand_text.pl:

$textfile = "/path/to/quotes.txt";  # Path to your text file
$separator = "%%";                   # Separator between quotes
Creating Your Text File

Format your text file with quotes separated by %% on its own line:

The only way to do great work is to love what you do. - Steve Jobs
%%
Innovation distinguishes between a leader and a follower. - Steve Jobs
%%
Your time is limited, don't waste it living someone else's life. - Steve Jobs
%%
Stay hungry, stay foolish. - Steve Jobs

Usage Examples

Basic Usage (SSI)
<!--#exec cgi="/cgi-bin/rand_text.pl"-->
With Custom Styling
<div class="quote-of-the-day">
    <!--#exec cgi="/cgi-bin/rand_text.pl"-->
</div>

<style>
.quote-of-the-day {
    font-style: italic;
    padding: 15px;
    border-left: 4px solid #007bff;
    background: #f8f9fa;
    margin: 20px 0;
}
</style>
Multiple Text Files

Pass the filename as a query parameter:

<!-- Display random quote -->
<!--#exec cgi="/cgi-bin/rand_text.pl?file=quotes.txt"-->

<!-- Display random tip -->
<!--#exec cgi="/cgi-bin/rand_text.pl?file=tips.txt"-->

<!-- Display random testimonial -->
<!--#exec cgi="/cgi-bin/rand_text.pl?file=testimonials.txt"-->
As JavaScript Include (Alternative)
<script src="/cgi-bin/rand_text.pl"></script>

Requires modifying the script to output JavaScript instead of HTML.

Creative Uses

Content Ideas
  • Quotes: Inspirational, motivational, or topic-specific quotes
  • Tips: Daily tips, tricks, or advice
  • Testimonials: Customer reviews or feedback
  • Fun Facts: Interesting trivia or did-you-know items
  • Product Highlights: Featured products or services
  • Jokes: Daily humor or dad jokes
Display Locations
  • Website header or footer
  • Sidebar widgets
  • Homepage feature section
  • Email signatures (static export)
  • Loading screens
  • 404 error pages

Troubleshooting

  • Check file permissions (should be 755)
  • Verify the Perl path in shebang line
  • Ensure text file path is correct
  • Check server error logs for details

  • Browser may be caching the SSI output
  • Check that rand() function is working
  • Verify separator (default %%) is correct
  • Ensure text file has multiple entries

  • Ensure your file has .shtml extension
  • Check that SSI is enabled on your server
  • Verify CGI execution is allowed via SSI
  • Contact hosting support if needed

Related Downloads

Random Link

Display random links or banners on your site.

Random Image

Show random images or graphics dynamically.

TextClock

Display current date and time via SSI.

Back to Random Text Overview Script Archive Home