Forum Moderators: coopster

Message Too Old, No Replies

Random Quotes Script Help

Is it possible to use .php includes instead?

         

madcat

11:28 am on Jun 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm trying to gett this script to output includes instead of text quotes, but nothing I try to put in an array will work. Is this at all possible?

The idea is to show a new include every time a visitor comes back to the site after reload. Do you know of any other scripts that would help me out or would this work?

<?php
$quotes[] = "I would rather this be a .php include";
$quotes[] = "I would rather this be a .php include 2";
$quotes[] = "I would rather this be a .php include 3";

srand ((double) microtime() * 1000000);
$randomquotes = rand(0,count($quotes)-1);

echo "" . $quotes[$randomquotes] . "";
?>

Thanks!

jatar_k

3:48 pm on Jun 23, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



<?php
$quotes[] = 'file1.php';
$quotes[] = 'file2.php';
$quotes[] = 'file3.php';

srand ((double) microtime() * 1000000);
$randomquotes = rand(0,count($quotes)-1);

include $quotes[$randomquotes];
?>

you might have to play with the path but the premise will work