[Req / Search for] Quote-File reader block/widget
I’m currently switching from Geeklog to WP and I’m looking for a plugin / widget that displays me 1 line out of a txt file on the server (containing irc quotes). In Geeklog there was a very simple solution “Chalkboard”: A php function which was called within a sidebar block. I tried to use this code within a php widget (php-code-widget.1.1) but that didn’t work…
So anyone an idea how to solve this?
Like said the goal is to display 1 single line out of a txt file which is filled with several quotes. That line should be displayed in a sidebar widget box.
Here’s the org. code from the Geeklog Chalkboard:
– – –
function phpblock_chalkboard($quotefile = “/home/andrew/bot/quoteable.quotes”, $delim = “\n%\n”)
die (“You forgot to specify $quotefile”);
die (“$quotefile does not exist! check your paths?”);
$fp = fopen($quotefile, “r”)
or die (“Error opening file!”);
$contents = fread($fp, filesize($quotefile));
$quote_arr = explode($delim,$contents);
$quote_index = (rand(1, sizeof($quote_arr)) – 1);
$returnquote = $quote_arr[$quote_index];
– – –
Maybe there’s already such a small gimmick out there which I just didn’t find?!
- The topic ‘[Req / Search for] Quote-File reader block/widget’ is closed to new replies.