tips and tricks for movable type

recent categories with entries
December 15, 2002

Some PHP code from Just a Gwai Lo found in this thread gives you the 5 most recently updated categories.

<?php

$max = 5;
$categories = array();

<MTEntries lastn="20">

$text = "<a href=\"<$MTEntryLink archive_type="Category"$>\"><$MTEntryCategory$></a>";

if (count(categories) <= $max && !in_array($text, $categories))
{
$categories[] = $text;
}
</MTEntries>

for ($i = 0; $i < $max; $i++)
{
print($categories[$i]."<br />\n");
}

?>

You can change 5 and 20 to suit your needs.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 1
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/122)

» recently updated category
Excerpt: shelley posted how to do this using php
Weblog: empty pages
Tracked: 12.16.02 04:01 PM