Recent Changes - Search:




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


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($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:

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

Banner 1

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:)

-- 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.

Edit - History - Print - Recent Changes - Search
Page last modified on June 05, 2013, at 03:27 PM