" /> markpasc.org: January 2006 Archives

« November 2005 | Main | February 2006 »

January 13, 2006

RandomOTDEntry

RandomOTDEntry, for displaying a random entry from this day in previous years

Download RandomOTDEntry 1.3 (23 February 2003)

RandomOTDEntry displays a random entry from the day the template is published in previous years. For example, if a template using RandomOTDEntry is published on 25 March 2003, an entry will be randomly selected from the entries posted 25 March 2001 and 25 March 2002 (assuming you started the weblog in 2001, so there are no entries on 25 March 2000).

RandomOTDEntry fully executes template code inside it. Also, no matter how many times you republish the template, the same entry is used (so you can use it in your RSS feed without spamming your readers with a new history entry every time your feed is republished that day).

Tip: if you do use RandomOTDEntry in your RSS feed, try using Today in <MTEntryDate format="%Y">: <MTEntryTitle> for the title instead of simply <MTEntryTitle>. Otherwise people will not notice it's not a new post, especially when viewing in their aggregators.

RandomOTDEntry was inspired by Brad Choate's OnThisDay plugin. (Originally I did it with a combination of OnThisDay and another of Brad's plugins, MTPerlScript.)

Using RandomOTDEntry

To install, drop the above file as RandomOTDEntry.pl into your plugins directory, then modify your template to call it, e.g.:

<MTRandomOTDEntry> your entry template code </MTRandomOTDEntry>

RandomOTDEntry supports no options.

EntryContents

EntryContents

Download EntryContents 1.3 (1 September 2003)

EntryContents lists the number of words, paragraphs, images, or links in your entries. It's based on Adam Kalsey's WordCount plugin, but will also discount the number of words used in the excerpt, if the excerpt is taken from the entry body. This is good for RSS feeds where you may want to list the word count next to the excerpt but want to only say how much more of an item there is.

Using EntryContents

To install, drop the above file as EntryContents.pl into your plugins directory, then modify your template to call it, e.g.:

<$MTExcerpt$> (<$MTEntryContents word="1" link="1"$>)

The options EntryContents supports are:

word="1"
Show the number of words in the entry (e.g., 372 words). If the entry's excerpt is automatically generated from the first few words of the entry body, EntryContents lists the number of words not in the excerpt (e.g., 352 more words).
no_generate="1"
Don't bother with the excerpt mess above; list the number of words in the entry body, no more and no less.
paragraph="1"
Show the number of paragraphs in the entry (e.g., 7 paragraphs). If the entry contains HTML paragraph tags, EntryContents count those; otherwise it counts the number of blank lines (consecutive pairs of carriage returns).
link="1"
Show the number of a tags in the entry.
image="1"
Show the number of img tags in the entry.
glue="string"
Put string between the above counts when concatenating them. The default is "; ", for a result like 352 more words; 7 links; 1 image.

Future enhancements

  • Only count a hrefs as links.
  • Count object tags as images.