The attached add-on files may be out of date. Please visit Devot-ee for the latest versions.
This plugin allows you to output random numbers.
PARAMETERS
1) min - Optional. Allows you to specify the lowest number to return. Default value is “1”.
2) max - Optional. Allows you to specify the highest number to return. Default value is “50”.
3) invalid_input - Optional. Accepts two values: “alert” and “silence”. Default value is “silence”. If the value is “alert”, then in cases when the plugin has some problem with parameters, PHP alert is being shown; if the value is “silence”, then in cases when the plugin has some problem with parameters, it finishes its work without any alert being shown. Set this parameter to “alert” for development, and to “silence” - for deployment.
VARIABLES
The plugin supports one hundred variables of the type outlined below:
{random_number_0}, {random_number_1}, {random_number_2}, {random_number_3}, … {random_number_10}, {random_number_11}, {random_number_13}, …, {random_number_99}
The numbers at the end of variables are used only to differentiate variables from each other.
Conditionals are supported.
EXAMPLE OF USAGE
{exp:random_number min="1" max="10"}
{if random_number_0 > 5}
Some code
{if:else}
Some code
{/if}
{/exp:random_number}
A more complicated example - Random Number plugin together with Child categories and Category Info plugins used to output three random categories:
{exp:cat_info category_id="179" parse="inward"}
{exp:random_number min="1" max="{cat_info_nonempty_subcategories_number}" parse="inward"}
{exp:child_categories parent="179" child_categories_sort_by="name" child_categories_sort_direction="asc" show_empty="no" entries_sort_by="date" entries_sort_direction="asc" entries_limit="10" site="1" parse="inward"}
{child_category_start}
{if "{random_number_0}" == "{child_category_count}" OR "{random_number_1}" == "{child_category_count}" OR "{random_number_2}" == "{child_category_count}"}
<a href="http://{child_category_url_title}">{child_category_name}</a>, number of entries: {entries_total}
{child_category_description}
{/if}
{child_category_end}
{/exp:child_categories}
{/exp:random_number}
{/exp:cat_info}
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.