×
Create a new article
Write your page title here:
We currently have 3,189 articles on s23. Type your article name above or create one of the articles listed here!



    s23
    3,189Articles

    MediawikiExtensions/Fnord

    Revision as of 23:08, 18 March 2006 by imported>Took (Reverted edit of 200.69.24.9, changed back to last version by mutante)
    (diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

    An extension for discordians. Use <fnord></fnord> to produce random fnord definitions. You need to create your personal fnord table before ,like here.

    <?php
    #  Fnord Mediawiki extension
    # display random fnord definitions in wiki pages using a <fnord> tag
    # inside a {{Template:Fnord}}
    # input can be used for LIMITing the mysql random select (later)
    # by mutante 17.04.2005
    
    $wgExtensionFunctions[] = "wfFnordExtension";
    
    function wfFnordExtension() {
    global $wgParser;
    $wgParser->setHook( "fnord", "renderFnord" );
    }
    
    function renderFnord( $input ) {
    
    $input = mysql_escape_string($input);
    
    # check if input is integer else set to 1
    if (is_int($input)){
    $limit = $input;
    } else {
    $limit = 1;
    }
    
    $hd = mysql_connect("localhost", "wikiuser", "PASSWORD") or die ("Unable to connect");
    mysql_select_db ("wikidb", $hd) or die ("Unable to select database");
    $res = mysql_query("SELECT * from fnord ORDER BY rand() LIMIT 0,$limit", $hd) or die ("Unable to run query");
    while ($row = mysql_fetch_assoc($res))
    {
    $id = $row["id"];
    $fnord = $row["text"];
    }
    $output = " $fnord ((K)fnord_id #$id))";
    
    return $output;
    
    }
    
    ?>
    

    put this into /var/www/wiki/extensions/ as FnordExtension.php

    read more on Template_talk:Fnord

    Cookies help us deliver our services. By using our services, you agree to our use of cookies.
    Cookies help us deliver our services. By using our services, you agree to our use of cookies.