Random Quote block error.......
Posted: Thu May 13, 2004 9:09 pm
Heres teh code:
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?
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;
?>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?