|
Cookbook /
RandomPageSummary: Include a random wiki page from a supplied list of pages.
Version: 1.0
Status: Stable
Prerequisites: pmwiki-2.0
Maintainer: ccox
Categories: Includes
Votes:
OverviewThis allows you to create a random page include anywhere inside of a page. For example, you could have a random banner on a page.
Markup('randpage','<include',
"/\\(:randpage\\s*(.*?):\\)/e",
"randomPage('$1')");
function randomPage($opts) {
$args = ParseArgs($opts);
srand((float) microtime() * 10000000);
$randPageIndex = array_rand($args['']);
return "(:include " . $args[''][$randPageIndex] . ":)";
}
Insert the following into your page: (:randpage Banners/Banner1 Banners/Banner2 Banners/Banner3 MyBanner/Thing:) When that page is displayed it will include one of the pages given as arguments to the randpage directive. For example:
Notes and CommentsOne can now include a random page by using the
-- Pm March 08, 2006, at 04:50 PM See Also
ContributorsCategory: Includes
|