The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[Req / Search for] Quote-File reader block/widget (1 post)

  1. Space-Rat
    Posted 7 years ago #


    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];
    return $returnquote;
    - - -

    Maybe there's already such a small gimmick out there which I just didn't find?!

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.