MTRandomEntries

MTRandomEntries is a plugin that, like MTRandomComment , pulls out a random entry from the current blog.

Usage Example:

<MTRandomEntries category="Gaming" lastn="5">
<a href="<$MTEntryLink$>"><$MTEntryTitle$></a>:<br />
<$MTEntryExcerpt$><br />
</MTRandomEntries>

Download randomentries.tar.gz or randomentries.zip , unpack it, and place randomentries.pl in your plugins directory.

MTRandomEntries

  • Container tag for the random entries that acts like MTEntries
  • If used within MTCategories , the random entries are chosen from current category.
  • If used within MTEntries , MTEntry , an Individual Archive, etc. or anything that contains an entry, the random entries are chosen from the categories of the current entry, OR-ed together.
  • It takes the following arguments:
    • category: Restrict the list of entries from which the random entries are chosen to those in specific categories. You can either supply a specific category, or use AND or OR like in MTEntries
    • lastn: Generate n random entries, defaults to 1

ChangeLog

  • Version 0.5: Added support for current entry categories
  • Version 0.45: Added support for AND and OR in category argument
  • Version 0.3: Added support for MTCategories
  • Version 0.2: Fixed lastn > number of entries bug
  • Version 0.17: Fixed MT Date tag bug
  • Version 0.15: Fixed bleeding
  • Version 0.1: First version

46 TrackBacks

MTRandomEntries looks interesting. I might have to ask Shannon if she can install it so I can have a wee Read More

New MT Plug-in: Random Entry from ETC. Indulging my inner geek on December 4, 2002 2:28 PM

David Raynes has made a great new plug-in for movabletype that will generate a random entry from you blog. Perfect Read More

mtforums= a title="movabletype.org : Support Forum" href="http://www.movabletype.org/cgi-bin/ikonboard/ikonboard.cgi?s=3dee690d1a54ffff;act=ST;f=20;t=11300" target="_blank">random entries link=http://www.rayners.org/archives/000106.php author=David Ray... Read More

Just thought I would let all you :mt: users know of a couple of cool new hacks by David Rayners Read More

Feeling random... from Live in the Delirious Cool on December 5, 2002 10:14 AM

So if you notice something new around these parts, it just means you're observant. Read More

Feeling random... from Live in the Delirious Cool on December 5, 2002 10:14 AM

So if you notice something new around these parts, it just means you're observant. Read More

Thanks to David Raynes, I now have a 'random entry' section on the sidebar. This is created using his MTRandomEntries plug-in, which is the first Read More

Finally! from cocktail onions on December 30, 2002 6:22 AM

I've finally finished uploading and entering all of the photo details into my eclipse gallery I installed an MT Plugin for random entries to make the index page display a random photo from each category. You can still get to Read More

I used a combination of two plugins by David Raynes - MTOtherBlog and MTRandomEntries - to add a random picture Read More

Random entries plugin. Looking for something different. Read More

display a random entry or comment from Al-Muhajabah's Movable Type Tips on March 10, 2003 12:34 AM

The section called "Wayback Machine" is intended to feature random entries and comments from my blog. I added this to encourage people to check out some of my older entries that they might not have seen before. For the featured... Read More

I have an idea for an MT plugin that I want to use in several places, but I'm having no luck wrapping my brain around the examples I have at my disposal to get it working. Perhaps the LazyWeb could help me create a DaysOffset container. Read More

Thanks to David Raynes, I now have a 'random entry' section on the sidebar. Read More

Random Entries ; A Nice plugin For MT from يك كليك براي هميشه on July 20, 2003 6:04 AM

اين هم يك پلاگين تقريبا جالب و بازديد آور در ام تي . با استفاده از اين پلاگين مي توانيد ، از بين كل نوشته هاي خود در ام تي ، تعداد مشخصي را به ص... Read More

Random Entries ; A Nice plugin For MT from يك كليك براي هميشه on July 20, 2003 6:07 AM

اين هم يك پلاگين تقريبا جالب و بازديد آور در ام تي . با استفاده از اين پلاگين مي توانيد ، از بين كل نوشته هاي خود در ام تي ، تعداد مشخصي را به ص... Read More

Random Entries ; A Nice plugin For MT from يك كليك براي هميشه on July 20, 2003 7:20 AM

اين هم يك پلاگين تقريبا جالب و بازديد آور در ام تي . با استفاده از اين پلاگين مي توانيد ، از بين كل نوشته هاي خود در ام تي ، تعداد مشخصي را به ص... Read More

Random Entries ; A Nice plugin For MT from يك كليك براي هميشه on July 22, 2003 4:33 AM

اين هم يك پلاگين تقريبا جالب و بازديد آور در ام تي . با استفاده از اين پلاگين مي توانيد ، از بين كل نوشته هاي خود در ام تي ، تعداد مشخصي را به ص... Read More

David Raynes: mtRandomEntriesrandomentries.pl uploaded to plugins No documentation included with the zip file. From the website:<mtRandomEntries category="Gaming" lastn="5"> <a href="<$mtEntryLink$>"><... Read More

I received an email this morning requesting the code for my random images - top right hand corner. Being of... Read More

I received an email this morning requesting the code for my random images - top right hand corner of the... Read More

After using David Raynes' <a href="http://www.rayners.org/archives/000106.php">MTRandomEntries plugin</a> for about a day, I decided I wanted a truly dynamic randomly-generated list... Read More

After using David Raynes' MTRandomEntries plugin for about a day, I decided I wanted a truly dynamic randomly-generated list of... Read More

After using David Raynes' MTRandomEntries plugin for about a day, I decided I wanted a truly dynamic randomly-generated list of... Read More

After using David Raynes' MTRandomEntries plugin for about a day, I decided I wanted a truly dynamic randomly-generated list of... Read More

After using David Raynes' MTRandomEntries plugin for about a day, I decided I wanted a truly dynamic randomly-generated list of... Read More

After using David Raynes' MTRandomEntries plugin for about a day, I decided I wanted a truly dynamic randomly-generated list of... Read More

I originally added the plugin for them back in December 2002 but successive re-installations of Movable Type have meant that I'd forgotten to re-add it. So here they are again. Read More

I originally added the plugin for them back in December 2002 but successive re-installations of Movable Type have meant that I'd forgotten to re-add it. So here they are again. Read More

Plugging in from Tao of Dowingba on February 3, 2004 2:05 AM

I currently use, and have used in the past, several Movable Type plugins. Here's the list: Optional-Redirect v0.1: A very useful plugin that allows you to turn off the annoying 'redirect' feature on MT 2.661 comment author links. MT-Blacklist: Let's... Read More

主にトップページを変更。 今までトップページには、最近のエントリーが3つ表示されていた。これをarchippellaの簡単な説明と、ランダムにピックアップされた3つのエントリーを表示するã... Read More

MTRandomEntries Pluginは、すべてのエントリーからランダムにエントリーを抜き出すプラグインである。 使い方はいたって簡単。<MTEntries>タグを<MTRandomEntries>に変更すればよい。なお、... Read More

Who and what helped me in my quest for the best look, feel and experience. (I'm talking about this site, not Viagra!) Read More

Who and what helped me in my quest for the best look, feel and experience. (I'm talking about this site, not Viagra!) Read More

Who and what helped me in my quest for the best look, feel and experience. (I'm talking about this site, not Viagra!) Read More

BB's Script, Plugin and Hack Archive as of 3/1/04: Collapse... Read More

Introduction Inspired by the rather enjoyable meme, I decided to integrate an ongoing series of Page 23 posts on my sidebar. To summarise the original aim of the meme, it has each participant write the fifth sentence on the 23rd... Read More

Introduction Inspired by the rather enjoyable meme, I decided to integrate an ongoing series of Page 23 posts on my sidebar. To summarise the original aim of the meme, it has each participant write the fifth sentence on the 23rd... Read More

Colofon from c u l t u r e k i t c h e n on May 7, 2004 9:54 PM

This site was created with MovableType and I am happy to say that will be beta-testing MovableType 3.0 soon. Why MT? It has an amazing communityof webmasters and independent developers supporting and extending the product. I use the following plug-ins:... Read More

MT的随机文章 from 生活像啤酒一樣苦 像巧克力一樣的甜 on August 12, 2004 10:20 PM

六翼有很多好玩的東西不願公布出來(~_~)。我把他前幾天告訴我的這個MT的隨機文章介紹一下。 這個plugin的特點就是將以前發表的文章隨機的公布出來。下載randomentries.zip之後,解凍,將randomentrie... Read More

This is my new home for Idiot Wind using MT3.12. The most time-consuming task was the need to re-edit the imported Blogger entries in order to correct their BlogTitle. As the Blogger’s title tag was something of a luxury available... Read More

Because you can never get enough SF Signal! I have added a new "Past Ramblings" section to the blog's main page sidebar. This gives newcomers (and even oldtimers) a chance to sample some of our past spurts of intelligence. Or... Read More

½ñÌìÐÞ¸ÄÁËһЩ´úÂë from ¡¾Ë®±ßÊ÷ľ±Ê¼Ç¡¿--Éú»î¡¢¼Ç¼¡¢½ÌÓý¡¢¸ÐÏë on January 15, 2005 10:41 AM

¡¡¡¡Ö÷ÒªÊǽüÀ´ÔâÊÜ´óÁ¿µÄÀ¬»øÁôÑÔµÄɧÈÅ¡£ÎÞÄÎ֮ϣ¬Ö»ºÃÐÞ¸ÄÁ˻ظ´µÄÎļþÃû³Æ¡£ÏÖÔÚÀ¬»ø»Ø¸´ÒѾ­Öð½¥³ÉΪ¹«º¦ÁË£¬¾ÓÈ»»¹Ó¦Ô˳öÏÖÁËÈAÈË·´Blog Spam“ÃË¡£ ¡¡¡¡ÁíÍâ¾ÍÊÇÔö¼ÓÁËËæ»úÎÄÕÂÔÚÿƪÎÄÕµĽáβ£¬Ã»ÓÐʲôÒâÒ壬ºÃÍæ°ÕÁË¡£... Read More

Finally! The photo gallery is open once again and updated with all the new pictures from the last year and a half. It took me forever to get it all to do what I wanted it to. When I had... Read More

Plugin-fest! from Nästa: Bandhagen on February 17, 2005 7:36 PM

Nu har jag installerat två plugin: MTBlogPings räknar helt enkelt antalet trackbacks din blogg tagit emot och funkar således precis likadant som MTBlogEntryCount och MTBlogCommentCount. För att se hur det hela funkar, scrolla längst ned på sidan ... Read More

Random Entries Using PHP from Learning Movable Type on April 12, 2005 9:07 AM

There are two methods to create a random entry, pulled from your weblog database (if you aren't using dynamic publishing). The easiest is David Raynes' MTRandomEntries plugin. However, MTRandomEntries generates a random entry only when you rebuild the ... Read More

More on Random Quotes from Toni's Corner of the World on April 27, 2005 9:43 PM

I really should read through tutorials more thoroughly, instead of cut and paste and get it published. David Raynes' MTRandomEntries plugin only generates a random entry when you rebuild the page, and I didn't realise that's what was happening. Because... Read More

30 Comments

Hey David,

Is there any way to use this with only a particular category? I'm setting up a photography site, and I'd like to show a random picture from each of my multiple categories.

Question about this plugin -- is the randomization on REBUILD or on REFRESH?
It seems that having it re-randomized on refresh is almost more desirable than rebuild - each one has it's point...

Thanks!

This worked fine until I started using XML-RPC tools to post to my blog. Now, when I ask MT to do a rebuild via XML-RPC, it complains that I'm using an MTEntryLink outside MTEntries - it's fine if I rebuild manually (ie by clicking Rebuild), but it breaks if I try to rebuild via XML-RPC.

Any ideas? I love the feature - shame to have had to take it away because I'm now posting via SMS.

Thanks in anticipation - sorry to bother you...

Is there any way to make this work over multiple categories? (i.e. category="1933 OR 1934 OR 1935")

I receive a "no 1933 OR 1934 OR 1935 category" error now.

THanks.

Wow. You work quickly. Thanks.

how do I restrict the random entries to my current post's category ?

thanks!

I'm currently using this on my index page of a photoblog and it works fine, but when I put the same code on my individual archive page, it errors out on my latest entry. (I've uploaded new entries and it always dies on the latest.)

[error]
Building entry 'Snowy Landscape' failed: Build error in template 'Individual Entry Archive': Error in tag: No such category 'MT::Category=HASH(0x87764b4)'
[/error]

Do you have a clue what is wrong, because I'm completely stumped. I couldn't find anything in your comments here or in the thread on the MT forums.

Thanks,
Erik

This is just fabulous...Thanks for the work.

Emily asked this but I didn't see an answer - is there a way to make this work on refresh instead of on reload? Reload is useful, but refresh would be even better. Thanks for the great plugin!

Well, because of the way MT builds its pages, a plugin can only grab a random entry when the template is rebuilt, not when it is refreshed. If you want to do it during a refresh, you'll have to use PHP to do that.

I'm now using this in combination with php in one place, and in combination with MTOtherBlog in another.
Your plug-ins are neat.

I like how your site is set up. looks great.

Hey Dave, I want to do something like this- is it possible?:

<MTRandomEntries Category="ALL" lastn="1"><MTEntryBody><MTRandomEntries>

So that it would select randomly 1 entry from any random category while including every category on the blog. Is that another plugin idea, like MTRandomCategories?

Your site looks great. What are your fees to do one for me?

I really like your plugin for what it does, but I came across a strange phenomenon: It seems that the MTRandomEntries tag works somewhat different to the MTEntries tag.

Could you please help my fixing that:
My fotolog is at http://www.alexemde.de/fotolog
It shows 5 recent entries at the bottom of the side but I rather have it show 5 random entries.

So I changed the opening tag as well as the closing tag from MTentries to MTRandomEntries, the rest of the template stays the same word by word. And here is what it does: http://www.alexemde.de/fotolog/week_2003_08_03.html

Any suggestions?

Cheers, Alexandra

I'm also getting this error when trying to build on individual entry pages, sans category variable (fine when I call the category manually on index pages):

[error]
Building entry 'Entry Title' failed: Build error in template 'Individual Entry Archive': Error in tag: No such category 'MT::Category=HASH(0x87764b4)'
[/error]

Any idea why?

I created a version of this plugin in PHP today that will refresh the list upon page reload, rather than template rebuilding. Check it out: http://www.gabeanderson.com/life/2003/08/29/mt_random_entries.php.

Is there a way to exclude only a couple of categories? There are many categories in the blog where I'm using this, and I'd like to just exclude one or two without listing the ones I'm including. A "NOT" function would be nice in the category selection, in other words.

Hi,

I have added the script to the page. Script displays 1 entry from specified category. But this random entry displayed on my site is only generated when I rebuild my site / page.

Is is possible to show randomly this entries each time page is reloaded / each time user makes a visit to the site?

-- m

The entries can't be random every time I refresh the browser :(

Same problem as a couple of others - on individual index pages, get

Build error in template 'Individual Entry Archive': Error in tag: No such category 'MT::Category=HASH(0x86fb3bc)'

Shame. I was keen to get this working :(.

Here's some craziness. I want to use this to generate a random entry that excludes categories. Is that possible unto itself or using other plugins in cohoots?

what particular php feature are we going to use if we want to have a random entry displayed each time a page is reloaded? ty

congrats mate! Fine job and fine site!



David

Ok, I will sign your blog. I really love your site.



Kevin

Ok, I will sign your blog. I really love your site.



Samuel

Getting the indiv entry problem myself:

Build error in template 'Individual Entry Archive': Error in tag: No such category 'MT::Category=HASH(0x86fb3bc)'

This is what happens when I don't specify a cateogry. But the added problem is that when I do specify a category the rebuild stalls out completely after about 20 entries.. Weird behavior. If anyone solves this please email me!

i get the following error when trying to do a build that includes an MTRandomEntries tag. Any help would be appreciated.

Can't use an undefined value as an ARRAY reference at plugins/randomentries.pl line 32.

Thanks!

Hi David,
I'm getting this error when I navigate from any category archive page to this page:
http://www.empyrealenvirons.com/categorylisting.html

Fatal error: Smarty error: [in evaluated template line 93]: syntax error: unrecognized tag 'MTRandomEntries' (Smarty_Compiler.class.php, line 580) in /*my domain*/mt/php/extlib/smarty/libs/Smarty.class.php on line 1088

Any idea what it could be?

Thanks,
Joanna

Leave a comment

About Me

I am a software developer for Six Apart living outside of Baltimore, MD. I have written a number of plugins for Movable Type, including the award winning MultiBlog, which has (as of MT 4) been integrated into the base application....
More...

Recent Entries

  • Minimalist plugins are fun!

    Last night I whipped up one of the smallest plugins I’ve ever written. It is so small in fact that I was able to stuff...

  • Feedburner Widget on MT News

    Movable Type News A WordPress 2.5 Upgrade Guide: And of course there are lots of third-party plugins for the MT dashboard, to integrate statistics and...

  • AD&D Monster Stats for the Presidential Canditates

    Charles Stross (scifi author, D&D nerd, and former perl columnist) posted Politics as she is Played with 3d6: The recent death of Gary Gygax, who...

  • Feedburner Widget 0.3

    At this point, I am really tempted to drop the ‘Widget’ from the name of the plugin, since it is doing so much more...

  • Feedburner Widget 0.2

    So I finally got around to updating the FeedburnerWidget plugin for MT 4.1 (since I finally got around to upgrading my install to MT 4.1)....

Close