I'm inserting a simple, well-rated script from hotscripts to randomly display quotes which are stored in a .txt file. The .txt file is not being recognized by the php script. I think maybe there is more to the .txt file than just entering quotes onto the blank page, seperated by hitting [enter], but I'm not sure. Thanks for any help.
This is the extent of the php script:
// The name of your quote file
$quote_file = "quotes.txt";
// Open the quote file
$fp = fopen($quote_file, "r"); error message says quotes.txt not found for this line, the .txt file is in Cwd of .php script
// Read the contents and tokenize the file to individual quotes
$quotes = fread($fp, filesize($quote_file));
$array = explode("\n",$quotes); wondering I have to specify the # of quotes for 'n'?
// Find a random quote
$array_index = (rand(1, sizeof($array)) - 1);
// Show the random quote
In order to make it work you first have to edit quotes.txt and put all the quotes you want displayed in it. Is there more to the .txt file than appears?