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");
}
?>
$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.
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