$random
variable
- $\random_a
- ...
- $\random_z
applicable sections
- html
associated template variables
- $_random_a001
- $_random_a002
- ... and so on.
description
Generates the specified number of template variables, each containing a unique value from 1 to the specified number.
notes
The random variables (a through z) allow for dynamic and capricious generation of values to present truly random content.
By specifying a single random variable in your vinetype.config file, you generate multiple variables for use in your template file.
example
$random_a:5
In the example above, we've just generated five template variables:
- $random_a001
- $random_a002
- $random_a003
- $random_a004
- $random_a005
Each time a page is created, these five variables will contain the values 001, 002, 003, 004, and 005, but in some random order. Values will not be repeated. These random values can be used in conjunction with other vinetype.config user variables to generate random content. For instance:
$greet001:Hello!
$greet002:Hola!
$greet003:Bonjour!
$greet004:G'day!
$greet005:Aloha!
To display one of these greetings randomly on your web page, place the following in your template file:
$greet$random_a001
When the page is loaded $random_a1
will resolve to one of the five values randomly such as 003, then
$greet003
will resolve to the text "Bonjour!"
If you want to display four of twenty different photos, number the photos one to twenty, create a random variable with 20 as its highest value, then use random values 001 through 004 in your template. A photo will not be repeated because all twenty values will be spread across all twenty random variables. You're only using the first four to provide a unique set of four each time.