Rather than generate a random list of files I was trying to get a random text file from the specified directory, and then display it's content. This would operate in a similar way to the random quote tag, but using separate text files for each item, also it would enable text files to be uploaded to a directory in the uploads directory through the file manager. I don't want to give global access through the file manager for security reasons etc.
I tried using the filelist TAG but couldn't get the contents of the file to print. Alternatively I tried setting parameters in the random_quote TAG, but kept getting error messages .
Code: Select all
#Check if user has specified a file, otherwise use default
if (isset($params['file']))
{$quotefile = $params['file'];}
else {$quotefile = "quotes.txt";}
With the filelist TAG I tried assigning the "file" as a variable and using the code from the random quote TAG to display the contents
when I assigned the fillist with the variable quote
Code: Select all
$fp = fopen($quote);
$contents = fread($fp, filesize($quote));
fclose($fp);
return $contents;