Range

This recipe was requested by PmWiki user Tomita. It allows to select a range of pictures to be displayed, among a larger set.

Installation

This wiki has in config.php the following user function:

function uMini_Range($a){ # selected slice
  $cmd = array_shift($a);
  list($first, $last) = explode('..', $cmd);
  if( isset($a[$first]) )
    foreach($a as $k=>$v) if($k!=$first) array_shift($a); else break;
  if( isset($a[$last]) )
    while(true){
      $v = array_pop($a);
      if($v!=$last) continue;
      $a[$v] = $v;
      break;
    }
  return $a;
}

Usage

Then, in the wiki page, we can use the Mini_Range: markup:

  Mini_Range:FIRST.jpg..LAST.jpg,*
  • The Mini set begins with a command indicating the first and last picture to be displayed.
  • A comma comes next.
  • Then, the full Mini set, for example "*", or "a*.jpg", or "*,-no.jpg".
  • No spaces!

Demo

All pictures:

mini7:*
Hurricane Dennis on July 7 2005 1550 UTC image01 image03 image04 ISS Aug2005 Kaernten CoA.svg loading bar M104 ngc4594 sombrero galaxy hi-res monde

Range from "image01.jpg" to "image04.jpg", note the comma before *

mini7_Range:image01.jpg..image04.jpg,*
image01 image03 image04

From the first to image04.jpg

mini7_Range:..image04.jpg,*
Hurricane Dennis on July 7 2005 1550 UTC image01 image03 image04

From image04.jpg to the end

mini7_Range:image04.jpg..,*
image04 ISS Aug2005 Kaernten CoA.svg loading bar M104 ngc4594 sombrero galaxy hi-res monde

Range from "image01.jpg" to "image04.jpg", except image03.jpg

mini7_Range:image01.jpg..image04.jpg,*,-*03*
image01 image04