Magic Main
Random Lines
Indy Lib Block

Get my PGP Key

Main Flarp!Bar ShirtWear WebServer Magic Software Misc.

This little chunk of PHP script loads a text file into an array (one array item per line in the text file) and then randomly prints out a number of items from it, without producing duplicates (unless, of course, there are duplicates in the text file you're loading in).

You will have to edit things to fit - mostly changing the obvious bits to point to your webroot directory and suchlike. I will not respond to any requests for help from people who don't bother to make this stuff fit their site.

If you only want to use this in one page, it's easiest to just stick the code where you want it - just paste the contents of this file into your page source and edit the obvious bits (how many lines to pick and the location of the file to load).

Alternatively, if you want to use the effect on multiple pages, adjust and upload this file to your site somewhere, use the Include instruction (<? include("/home/username/random.txt"); ?>) in each page where you want the effect to be available, then put <? randLines(3) ?> in your page where you want the random stuff to go in.