tips and tricks for movable type

combine descending days with ascending entries
August 03, 2002

So, you want to list your entries on your Main Index page in descending order ("newest at top"), but within each day's list of entries, you want ascending order ("oldest at top")? Here's how.

1. Turn on Daily Archiving in Blog Configuration | Archiving.

2. Set the "Order of entries displayed:" to "ascending" in Blog Configuration | Preferences. **

3. Use code like this in your Main Index Template:

<MTArchiveList archive_type="Daily">
<MTArchiveTitle><br />
<MTEntries>
...
</MTEntries>
</MTArchiveList>

4. If you want to format the display of the day's date, just substitute <MTArchiveDate> for <MTArchiveTitle>.

The reason this works is due to <MTArchiveList>; it sorts automatically in descending order.

The downside, of course, is that you've now added another method of archiving that you may not have needed or wanted before.

** If for some reason you don't want to set your order of entries to ascending across your entire blog, just add the sort_order attribute to <MTEntries> in the code sample.

Related Links:

• Original post on the MT support forum

Comments

This is definately a fudge to the problem I was having, however MT could be improved by Adding a sort_order command that allowed a Descending DayGroup / Ascending IndividualEntry code.

Just a thought

by clof | 01.22.03 01:38 AM

If you weren't already using Daily archives, and don't particulary want them built, you can set the Archive File Template to something like daily.html, and then create a new Archive Template with little or no content in it. That way, you aren't getting a tonne of extra files on your server. :)

by maddy | 04.07.03 07:05 PM

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/62)

» Ordering
Excerpt: A very helpful tip here allowed me to reorder the entries in this diary. As requested, they're now sorted descending overall with entries ascending within a given day. Hope this
Weblog: Phil's Diary
Tracked: 12.31.02 05:28 AM