<?php if (!defined('PmWiki')) exit(); // Script: released under copyleft, Luke Howison, lukehnz@gmail.com // 2005-06-15 // // Random Title Generator using $WikiTitle // // Tested with PmWiki 2.0 Beta 37 // //======================= // To make this script work, extract it in your pmwiki/cookbook directory. // Then open config.php and comment out the line containing $WikiTitle // // ## $WikiTitle // // Add the following line to config.php: // // include_once("$FarmD/cookbook/randtitle.php"); // //======================= // Configuration: // // Fill a pmwiki page (Main.RandomTitle) with titles, start every title with two asterisks. // SDV($RandTitleFile, "Main.RandomTitle"); SDV($RandTitleLineDelimiter, "**"); SDV($RandTitleRemoveItemize, false); function f_RandomTitle() { global $RandTitleFile; global $RandTitleLineDelimiter; global $RandTitleRemoveItemize; $peeptitle = ReadPage($RandTitleFile); $arrRandTitle = $peeptitle[text]; $arrRandTitle = str_replace($RandTitleLineDelimiter, "", $arrRandTitle); if ($QuoteRemoveItemize) { $arrRandTitle = explode("\n*", $arrRandTitle); $arrRandTitle[0] = substr($arrRandTitle[0], 1, strlen($arrRandTitle[0])-1); } else { $arrRandTitle = explode("\n", $arrRandTitle); } srand( (double)microtime() * 1000000 ); if (isset($arrRandTitle)) { shuffle($arrRandTitle); return "$arrRandTitle[0]"; } else { return ""; } } // Pointer to the function $randTitle =& f_RandomTitle(); $WikiTitle = $randTitle ?>