MediawikiExtensions/Fnord

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

setHook( "fnord", "renderFnord" ); }

function renderFnord( $input ) {

$input = mysql_escape_string($input);

if (is_int($input)){ $limit = $input; } else { $limit = 1; }
 * 1) check if input is integer else set to 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