Page 1 of 1

Random Quote block error.......

Posted: Thu May 13, 2004 9:09 pm
by drujr
Heres teh code:

Code: Select all

<?php

## put an empty line between each quote for this to work... 
## i.e.  random.txt:
## quote1 quote1 
## quote1 quote1
##
## quote2 quote2
## 
## quote3 quote3

$textfile ="/home/drujr/public_html/random.txt"; 

$f = implode('', file("$textfile"));
$quotes = explode("\n\n", $f);
$quote = rand(0, sizeof($quotes)-1);
$tmp = str_replace("\n", "<br>\n", $quotes[$quote]);
$content = $tmp;


?>
Heres the error i'm seeing:

Warning: file(/www/random.txt): failed to open stream: No such file or directory in /home/drujr/public_html/blocks/block-random_quote.php on line 14

Warning: implode(): Bad arguments. in /home/drujr/public_html/blocks/block-random_quote.php on line 14



ideas?

Posted: Thu May 13, 2004 11:11 pm
by feyd
/www/random.txt wasn't found or couldn't be opened.

Posted: Fri May 14, 2004 6:43 am
by kettle_drum
...the path to your file is incorrect, or the file doesnt exist.