Thank you, calguy. Thank you, cyberman for the attachments. Really appreciate it. It's going to take me a while to read and understand it. But guess what, I tried my hand on the php code of that plug-in tag (function.random_quote.php). It works according to what I want. I added two lines, and commented out one line.
function smarty_cms_function_random_quote($params, &$smarty) {
$delim = "\n";
// $quotefile points to the file that holds the actual quotes
$quotefile = $params['quotefile']; /* added */
if (file_exists($quotefile)) { /* added */
// $quotefile = "quotes.txt";
/* commented out */
$fp = fopen($quotefile, "r");
$contents = fread($fp, filesize($quotefile));
$quote_arr = explode($delim,$contents);
fclose($fp);
srand((double)microtime()*1000000);
$quote_index = (rand(1, sizeof($quote_arr)) - 1);
$herequote = $quote_arr[$quote_index];
return $herequote;
} /* added */
}
Now, if there is no bug, radom_quote accepts a parameter which is the filename of the quote file with its pathname included:
eg, in the same website,
in "musicians" section: {random_quote quotefile='uploads/quotesfiles/quotesmusicians.txt'}
in "poets" section: {random_quote quotefile='uploads/quotesfiles/quotespoets.txt'}
in "sages" section: {random_quote quotefile='uploads/quotesfiles/quotessages.txt'}
Today is my happy day!!
