Summary: Include a random wiki page from a supplied list of pages.
Version: 1.0
Status: Obsolete
Prerequisites: pmwiki-2.2.58
Maintainer: ccox
Categories: Includes

See the core documentation on PageLists with the order=random option.


This allows you to create a random page include anywhere inside of a page. For example, you could have a random banner on a page.


function randomPage($m) {
  $args = ParseArgs($m[1]);
  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:

(:randpage Banners/Banner1 Banners/Banner2 Banners/Banner3 Banners/Banner4 Banners/Banner5:)


Notes and Comments

One can now include a random page by using the (:pagelist:) markup:

(:pagelist group=Banners list=normal order=random count=1 fmt=#include:)

Total Commerce from 8 to 5

Have you ever seen a developer at 8am in the morning? Not a pretty sight. And 5pm, come on! We're just finishing the pizza.. probably from the night before. No coffee, no code, no pizza, no late nights, no commerce. Got it dude!
We Make Great Products (when we're awake)

-- Pm March 08, 2006, at 04:50 PM

See Also


Chris Cox

Category: Includes

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.