Categories
Movable Type

MTRandomLine plugin

I’ve just finished doing the documentation for my first Movable Type plugin, MTRandomLine. It’s a tag that extracts and displays a random line from a text file, or a Movable Type template module. Right now, I’m using the tag on this page to display the list of random entries you see in the sidebar.

Note that it only performs the random selection when the relevant MT template is rebuilt. It doesn’t give you a new random selection each time you visit the page. There are plenty of server-side and client-side scripts around that do that already (just go to the Movable Type support forum and do a search for “random”).

The tag is probably best suited to doing random quotes, or random images. It’s a bit of a stretch (though entirely possible) to make it display random blog entries. So my next project is to make a <MTRandomEntries> container tag, which will set up a context for a selection of random entries from your blog (or from a category within the blog). You’ll then be able to use the normal <MTEntryTitle>, <MTEntryBody> and other tags within it. Watch out for it soon!