Skip to content

Instantly share code, notes, and snippets.

@enminc
Created January 26, 2012 02:13
Show Gist options
  • Save enminc/1680499 to your computer and use it in GitHub Desktop.
Save enminc/1680499 to your computer and use it in GitHub Desktop.
MODX Snippet/OutputFilter that outputs the results of php rand() function
$min = 0;
$max = 10000000;
$input = $modx->getOption('input',$scriptProperties,null);
if(($input) && ($input != '')){ // used when used as output filter
$nums = explode(',',$input);
if($nums[0] != '' && is_numeric($nums[0])){
$min = intval($nums[0]);
}
if($nums[1] != '' && is_numeric($nums[1])){
$mac = intval($nums[1]);
}
}
else{ // when past in as a snippet property
$min = $modx->getOption('min',$scriptProperties,$min);
$max = $modx->getOption('max',$scriptProperties,$max);
}
return rand($min,$max);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment