指定した配列から1つ、または複数の要素を取り出した配列を返します。 / Pick one or more random items out of an array.
Perl PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
plugins/RandomArray
README.ja.md
README.md
sample.mtml

README.md

RandomArray - Movable Type Plugin

Japanese

Overview

Pick one or more random items out of an array.

Prerequisites

  • Movable Type 6.0 or higher (I confirmed it.)
  • Movable Type 5 (Maybe)

Installation

  1. Unpack the RandomArray's archive.
  2. Copy the "RandomArray" directory into /path/to/mt/plugins/

Usage

<mt:RandomArray name="entry_ids" limit="3" setvar="random_ids">

Attributes

name (required)

The name of the array.

limit (optional)

Specifies how many items should be picked. Default is 1.

destructive (optional)

This attribute is destructive. The original array is altered.

Basic Example

<mt:Entries tag="foo" limit="20">
    <mt:SetVarBlock name="entry_ids" function="push"><mt:EntryID></mt:SetVarBlock>
</mt:Entries>
<mt:RandomArray name="entry_ids" limit="3" setvar="random_ids">
<mt:Entries id="$random_ids">
<mt:EntriesHeader>
<ul>
</mt:EntriesHeader>
    <li><mt:EntryTitle escape="html"></li>
<mt:EntriesFooter>
</ul>
</mt:EntriesFooter>
</mt:Entries>

MT::Lover::bitpart