Sunday, July 13 2003

MTRoundRobin

Simple little MT plugin, created as a generalized alternative to FlipFlop.

Given a list of keywords to be substituted into the template, each call to <MTRoundRobin> returns a different item from the list, in order, wrapping back around to the beginning when it hits the end. Examples follow.

This would produce a list of blog entries with the background color alternating between gray and white:

<MTRoundRobin set="gray white">
<MTEntries>
<div style="background: <MTRoundRobin>">
...

This would alternate between black-on-white and white-on-black comments:

<MTRoundRobin set="black white white black">
<MTComments>
<div style="color: <MTRoundRobin>;background: <MTRoundRobin>">
...

The source code for RoundRobin is released into the public domain for anyone to freely use or modify.