Kirby CMS Tag and Page-Method to generate various random values.
Usage
Random string using Kirby Toolkit str::random()
forwarding the type if any.
(random: 5) or (random: 5 type:alpha)
Random positiv non-zero number with max value inclusive using PHP random_int()
.
(random: number length: 128)
Any one value of a comma seperated list.
(random: apple, banana, coconut)
Any random pool of values picked from a comma seperated list with optional length.
(random: red, green, blue, black, white, yellow type: pool)
or
(random: red, green, blue, black, white, yellow type: pool length: 3)
A number between a min and max value inclusive using PHP random_int()
.
(random: 41, 53 type: between)
Lorem Ipsum
text using a generator.
(random: lorem length: 5) or (random: lorem type: words length: 4)
(random: lorem type: sentences length: 3)
(random: lorem type: paragraphs length: 2)
(random: lorem type: chars length: 140)
The plugin also adds a $site->random()
function to use in templates etc.
// STRING
echo $site->random(23);
// NUMBER
echo $site->random([41, 53], 'between');
// POOL
// from a comma seperated string
echo $site->random('red, green, blue, black, white, yellow', 'pool', 3);
// or a php array
echo $site->random($myArray, 'pool', 3);
// LOREM
echo $site->random('lorem', 'paragraphs', 3);